code: def member_of(self, group):
          
          if isinstance(group, Group):
              group = group.name
          return self.groups.filter(name=group).exists()
docs: Returns whether a user is a member of a certain group.
  
          Args:
              group
                  The name of a group (string) or a group object
  
          Returns:
              Boolean