code: def valid_username(user):
      '''
      Validates a username based on the guidelines in `useradd(8)`
      '''
      if not isinstance(user, six.string_types):
          return False
  
      if len(user) > 32:
          return False
  
      return VALID_USERNAME.match(user) is not Nonf valid_username(user):
      '''
      Validates a username based on the guidelines in `useradd(8)`
      '''
      if not isinstance(user, six.string_types):
          return False
  
      if len(user) > 32:
          return False
  
      return VALID_USERNAME.match(user) is not None
docs: Validates a username based on the guidelines in `useradd(8)`