<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_contacts_for(self, user):
 """ Returns the contacts for this user. Contacts are other users that this user has received messages from or send messages to. :param user: The :class:`User` which to get the contacts for. """

        contacts = self.filter(Q(um_from_user=user) | Q(um_to_user=user))
        return contacts