code: def get_roles(username):
      '''
      Get roles that the username is assigned from switch
  
      .. code-block: bash
  
          salt '*' onyx.cmd get_roles username=admin
      '''
      info = sendline('show user-account {0}'.format(username))
      roles = re.search(r'^\s*roles:(.*)$', info, re.MULTILINE)
      if roles:
          roles = roles.group(1).strip().split(' ')
      else:
          roles = []
      return rolef get_roles(username):
      '''
      Get roles that the username is assigned from switch
  
      .. code-block: bash
  
          salt '*' onyx.cmd get_roles username=admin
      '''
      info = sendline('show user-account {0}'.format(username))
      roles = re.search(r'^\s*roles:(.*)$', info, re.MULTILINE)
      if roles:
          roles = roles.group(1).strip().split(' ')
      else:
          roles = []
      return roles
docs: Get roles that the username is assigned from switch
  
      .. code-block: bash
  
          salt '*' onyx.cmd get_roles username=admin