def create_edges(nodes, allow_partner=False):
    """
    Given a list of Elf nodes, return a list of edges.

    allow_partner:  if True, partners are also taken into account
        for possible gift making relationships. On default, partners
        are not allowed to be drawn as either elf or giftee of one
        another.
    """
    edges = [
        (node, neighbour)
        for node in nodes
        for neighbour in nodes
        if node != neighbour
    ]
    if not allow_partner:
        for node in nodes:
            for neighbour in nodes:
                if node.partner == neighbour.name:
                    edges.remove((node, neighbour))
    return edges