code: def get_selinux_context(path):
      '''
      Get an SELinux context from a given path
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' file.get_selinux_context /etc/hosts
      '''
      out = __salt__['cmd.run'](['ls', '-Z', path], python_shell=False)
  
      try:
          ret = re.search(r'\w+:\w+:\w+:\w+', out).group(0)
      except AttributeError:
          ret = (
              'No selinux context information is available for {0}'.format(path)
          )
  
      return ref get_selinux_context(path):
      '''
      Get an SELinux context from a given path
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' file.get_selinux_context /etc/hosts
      '''
      out = __salt__['cmd.run'](['ls', '-Z', path], python_shell=False)
  
      try:
          ret = re.search(r'\w+:\w+:\w+:\w+', out).group(0)
      except AttributeError:
          ret = (
              'No selinux context information is available for {0}'.format(path)
          )
  
      return ret
docs: Get an SELinux context from a given path
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' file.get_selinux_context /etc/hosts