<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def links(self, fromVertice, toVertice, **edgeArgs) : """ An alias to save that updates the _from and _to attributes. fromVertice and toVertice, can be either strings or documents. It they are unsaved documents, they will be automatically saved. """

        if isinstance(fromVertice, Document) or isinstance(getattr(fromVertice, 'document', None), Document):
            if not fromVertice._id :
                fromVertice.save()
            self._from = fromVertice._id
        elif (type(fromVertice) is bytes) or (type(fromVertice) is str):
            self._from  = fromVertice
        elif not self._from:
            raise CreationError('fromVertice %s is invalid!' % str(fromVertice))
        
        if isinstance(toVertice, Document) or isinstance(getattr(toVertice, 'document', None), Document):
            if not toVertice._id:
                toVertice.save()
            self._to = toVertice._id
        elif (type(toVertice) is bytes) or (type(toVertice) is str):
            self._to = toVertice
        elif not self._to:
            raise CreationError('toVertice %s is invalid!' % str(toVertice))
        
        self.save(**edgeArgs)