<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def link(self, definition, doc1, doc2, edgeAttributes, waitForSync = False) :
        "A shorthand for createEdge that takes two documents as input"
        if type(doc1) is DOC.Document :
            if not doc1._id :
                doc1.save()
            doc1_id = doc1._id
        else :
            doc1_id = doc1

        if type(doc2) is DOC.Document :
            if not doc2._id :
                doc2.save()
            doc2_id = doc2._id
        else :
            doc2_id = doc2

        return self.createEdge(definition, doc1_id, doc2_id, edgeAttributes, waitForSync)