code: def user_in_group(user, group):
      
      if isinstance(group, Group):
          return user_is_superuser(user) or group in user.groups.all()
      elif isinstance(group, six.string_types):
          return user_is_superuser(user) or user.groups.filter(name=group).exists()
      raise TypeError("'group' argument must be a string or a Group instance")
docs: Returns True if the given user is in given group