<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, _attributes=None, **attributes):
 """ Perform an update on all the related models. :param attributes: The attributes :type attributes: dict :rtype: int """

        if _attributes is not None:
            attributes.update(_attributes)

        if self._related.uses_timestamps():
            attributes[self.get_related_updated_at()] = self._related.fresh_timestamp()

        return self._query.update(attributes)