:type head: RandomListNode
    :rtype: RandomListNode
196198
def copy_random_pointer_v2(head):
    
    copy = defaultdict(lambda: RandomListNode(0))
    copy[None] = None
    node = head
    while node:
        copy[node].label = node.label
        copy[node].next = copy[node.next]
        copy[node].random = copy[node.random]
        node = node.next
    return copy[head]
376156
def get_id_head(self):
        '''
        
        '''
        id_head = None
        for target_node in self:
            if target_node.is_head():
                id_head = target_node.get_id()
                break
        return id_head
1113062
def from_list(lst):
        
        if not lst:
            return None

        head = Node(lst[0], None)

        if len(lst) == 1:
            return head

        head.next_node = LinkedList.from_list(lst[1:])
        return head
140772
def head(self, route: str(), callback: object()):
        
        self.__set_route('head', {route: callback})
        return RouteMapping
34876
private final void updateHead() {
        // Either head already points to an active node, or we keep
        // trying to cas it to the first node until it does.
        Node<E> h, p, q;
        restartFromHead:
        while ((h = head).item == null && (p = h.prev) != null) {
            for (;;) {
                if ((q = p.prev) == null ||
                    (q = (p = q).prev) == null) {
                    // It is possible that p is PREV_TERMINATOR,
                    // but if so, the CAS is guaranteed to fail.
                    if (casHead(h, p))
                        return;
                    else
                        continue restartFromHead;
                }
                else if (h != head)
                    continue restartFromHead;
                else
                    p = q;
            }
        }
    }
124247
def head(self, url, *args, **kwargs):
        
        res = self._conn.head(url, headers=self._prepare_headers(**kwargs))
        if res.status_code == 200:
            return res
        return None
250063
public int read_list_head() throws OtpErlangDecodeException {
        int arity = 0;
        final int tag = read1skip_version();

        switch (tag) {
        case OtpExternal.nilTag:
            arity = 0;
            break;

        case OtpExternal.stringTag:
            arity = read2BE();
            break;

        case OtpExternal.listTag:
            arity = read4BE();
            break;

        default:
            throw new OtpErlangDecodeException("Not valid list tag: " + tag);
        }

        return arity;
    }
578910
def head(self, *args, **kwargs):
        
        return self.session.head(*args, **self.get_kwargs(**kwargs))
1147317
def reverse_list_recursive(head):
    
    if head is None or head.next is None:
        return head
    p = head.next
    head.next = None
    revrest = reverse_list_recursive(p)
    p.next = head
    return revrest
554768
def edge_by_node(self, head, tail):
        
        for edge in self.out_edges(head):
            if self.tail(edge) == tail:
                return edge
        return None
389319
def reverse_list(head):
    
    if not head or not head.next:
        return head
    prev = None
    while head:
        current = head
        head = head.next
        current.next = prev
        prev = current
    return prev
134748
def head(self, n):
        
        return DataAccessObject({k: self.dict[k][:n] for k in self.dict})
524468
def Define_TreeTable(self, heads, heads2=None):
        ''' 
        '''
        display_heads = []
        display_heads.append(tuple(heads[2:]))
        self.tree_table = TreeTable()
        self.tree_table.append_from_list(display_heads, fill_title=True)
        if heads2 is not None:
            heads2_color = heads2[1]
            row_widget = gui.TableRow()
            for index, field in enumerate(heads2[2:]):
                row_item = gui.TableItem(text=field,
                                         style={'background-color': heads2_color})
                row_widget.append(row_item, field)
            self.tree_table.append(row_widget, heads2[0])
        self.wid.append(self.tree_table)
758545
def represent_list(self, data):
        
        node = super(Dumper, self).represent_list(data)
        length = len(data)
        if self.default_flow_style is None and length < 4:
            node.flow_style = True
        elif self.default_flow_style is None:
            node.flow_style = False
        return node
989714
public T head() {
        int index = iter.nextIndex();
        if (index >= list.size()) {
            throw new NoSuchElementException();
        } else {
            return list.get(index);
        }
    }
100682
def head(self, lines=10):
        
        self.seek(0)

        for i in range(lines):
            if not self.seek_line_forward():
                break
    
        end_pos = self.file.tell()
        
        self.seek(0)
        data = self.file.read(end_pos - 1)

        if data:
            return self.splitlines(data)
        else:
            return []
694814
def head_item(self):
        """"""
        delimiter = self.style.attr_minor(self.style.delimiter)
        hint = self.style.header_hint * self.wide
        heading = (u'{delimiter}{hint}{delimiter}'
                   .format(delimiter=delimiter, hint=hint))
        alignment = lambda *args: (
            self.term.rjust(*args) if self.style.alignment == 'right' else
            self.term.ljust(*args))
        txt = alignment(heading, self.hint_width, self.style.header_fill)
        return self.style.attr_major(txt)