<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(cls, **kwargs):
 """ Implements get_or_create logic for models that inherit from representatives.models.HashableModel because we don't have access to model methods in a migration scenario. """


    try:
        obj = cls.objects.get(**kwargs)
        created = False
    except cls.DoesNotExist:
        obj = cls(**kwargs)
        created = True
        calculate_hash(obj)
        obj.save()

    return (obj, created)