code: def assign(self, object_type, object_uuid, overwrite=False):
          
          if self.is_deleted():
              raise PIDInvalidAction(
                  "You cannot assign objects to a deleted/redirected persistent"
                  " identifier."
              )
  
          if not isinstance(object_uuid, uuid.UUID):
              object_uuid = uuid.UUID(object_uuid)
  
          if self.object_type or self.object_uuid:
              # The object is already assigned to this pid.
              if object_type == self.object_type and \
                 object_uuid == self.object_uuid:
                  return True
              if not overwrite:
                  raise PIDObjectAlreadyAssigned(object_type,
                                                 object_uuid)
              self.unassign()
  
          try:
              with db.session.begin_nested():
                  self.object_type = object_type
                  self.object_uuid = object_uuid
                  db.session.add(self)
          except SQLAlchemyError:
              logger.exception("Failed to assign {0}:{1}".format(
                  object_type, object_uuid), extra=dict(pid=self))
              raise
          logger.info("Assigned object {0}:{1}".format(
              object_type, object_uuid), extra=dict(pid=self))
          return True
docs: Assign this persistent identifier to a given object.
  
          Note, the persistent identifier must first have been reserved. Also,
          if an existing object is already assigned to the pid, it will raise an
          exception unless overwrite=True.
  
          :param object_type: The object type is a string that identify its type.
          :param object_uuid: The object UUID.
          :param overwrite: Force PID overwrites in case was previously assigned.
          :raises invenio_pidstore.errors.PIDInvalidAction: If the PID was
              previously deleted.
          :raises invenio_pidstore.errors.PIDObjectAlreadyAssigned: If the PID
              was previously assigned with a different type/uuid.
          :returns: `True` if the PID is successfully assigned.