code: def to_user(user):
          
          from sevenbridges.models.user import User
          if not user:
              raise SbgError('User is required!')
          elif isinstance(user, User):
              return user.username
          elif isinstance(user, six.string_types):
              return user
          else:
              raise SbgError('Invalid user parameter!')
docs: Serializes user to id string
          :param user: object to serialize
          :return: string id