<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_or_create(self, um_from_user, um_to_user, message):
 """ Get or create a Contact We override Django's :func:`get_or_create` because we want contact to be unique in a bi-directional manner. """

        created = False
        try:
            contact = self.get(Q(um_from_user=um_from_user, um_to_user=um_to_user) |
                               Q(um_from_user=um_to_user, um_to_user=um_from_user))

        except self.model.DoesNotExist:
            created = True
            contact = self.create(um_from_user=um_from_user,
                                  um_to_user=um_to_user,
                                  latest_message=message)

        return (contact, created)