code: def get_or_create(cls, **kwargs):
      
  
      try:
          obj = cls.objects.get(**kwargs)
          created = False
      except cls.DoesNotExist:
          obj = cls(**kwargs)
          created = True
          calculate_hash(obj)
          obj.save()
  
      return (obj, created)
docs: 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.