code: def user_to_uid(user):
      '''
      Convert user name to a uid
  
      user
          user name to convert to its uid
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' file.user_to_uid root
      '''
      if user is None:
          user = salt.utils.user.get_user()
      try:
          if isinstance(user, int):
              return user
          return pwd.getpwnam(user).pw_uid
      except KeyError:
          return 'f user_to_uid(user):
      '''
      Convert user name to a uid
  
      user
          user name to convert to its uid
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' file.user_to_uid root
      '''
      if user is None:
          user = salt.utils.user.get_user()
      try:
          if isinstance(user, int):
              return user
          return pwd.getpwnam(user).pw_uid
      except KeyError:
          return ''
docs: Convert user name to a uid
  
      user
          user name to convert to its uid
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' file.user_to_uid root