'Extend this path with a new vertex ancestors<-head, if this
path ends at the head node
@param head: the head node
@param ancestors: the ancestor sequence'

def extend(self, head, ancestors=None):

    if (ancestors is None):
        path = S3MultiPath.Path(head)
        head = path.first()
        ancestors = path.nodes[1:]
    last = self.last()
    if ((last is None) or (last == str(head))):
        append = self.append
        path = S3MultiPath.Path(ancestors)
        for i in path.nodes:
            if (not append(i)):
                break
        return self
    else:
        return None
