old_contents: """
  Script for display user groups and users in group Administrators
  
  Requirements: Python 2.7 or 3.4, pyWin32, pywinauto 0.5.3+
   download the repo: https://github.com/pywinauto/pywinauto
   place the script to the repo root folder
  """
  from subprocess import Popen
  from pywinauto import application
  from pywinauto.timings import always_wait_until_passes
  
  
  class AccessDeniedError(StandardError):
      """Raise when current user is not an administrator."""
      def __init__(self, arg):
          self.args = arg
  
  
  class NoExistGroupError(StandardError):
      """Raise when group Administrators is not exist."""
      def __init__(self, arg):
          self.args = arg
  
  
  def is_user_an_admin():
      """ Check user admin """
      import os
      if os.name == 'nt':
          try:
              # only windows users with admin privileges can read the C:\windows\temp
              os.listdir(os.sep.join([os.environ.get('SystemRoot', 'C:\\windows'), 'temp']))
          except WindowsError:
              return False
          else:
              return True
      else:
          return 'SUDO_USER' in os.environ and os.geteuid() == 0
  
  
  if is_user_an_admin():
      Popen(['compmgmt.msc'], shell=True)
  
  
      @always_wait_until_passes(4, 2, application.ProcessNotFoundError)
      def connect_to_mmc():
          """ Returns connect app to instance """
          return application.Application().connect(path="mmc.exe")
  
  
      app = connect_to_mmc()
      tree = app.mmc_main_frame.tree_view
      groups = tree.get_item(r'\Computer Management (Local)\System Tools\Local Users and Groups\Groups')
      groups.click()
      items = app.mmc_main_frame.list_view.items()
      print('\nGroups and descriptions:')
      for element in items:
          print(element.text())
      try:
          administrators = app.mmc_main_frame.list_view.get_item('Administrators')
          administrators.click(double=True)  # double click opens group properties
          app.dialog.wait('exists')
          items = app.dialog.list_view.items()
          print('\nAdministrators:')
          for element in items:
              print(element.text())
      except ValueError:
          print('\nThere is no Administrators group')
      app.kill_()
  else:
      print('\nYou are not administrator')
new_contents: """
  Script for display user groups and users in group Administrators
  
  Requirements: Python 2.7 or 3.4, pyWin32, pywinauto 0.5.3+
   download the repo: https://github.com/pywinauto/pywinauto
   place the script to the repo root folder
  """
  from subprocess import Popen
  from pywinauto import application
  from pywinauto.timings import always_wait_until_passes
  
  
  class AccessDeniedError(StandardError):
      """Raise when current user is not an administrator."""
      def __init__(self, arg):
          self.args = arg
  
  
  class NoExistGroupError(StandardError):
      """Raise when group Administrators is not exist."""
      def __init__(self, arg):
          self.args = arg
  
  
  def is_user_an_admin():
      """ Check user admin """
      import os
      if os.name == 'nt':
          try:
              # only windows users with admin privileges can read the C:\windows\temp
              os.listdir(os.sep.join([os.environ.get('SystemRoot', 'C:\\windows'), 'temp']))
          except WindowsError:
              return False
          else:
              return True
      else:
          return 'SUDO_USER' in os.environ and os.geteuid() == 0
  
  
  if is_user_an_admin():
      Popen(['compmgmt.msc'], shell=True)
  
  
      @always_wait_until_passes(4, 2, application.ProcessNotFoundError)
      def connect_to_mmc():
          """ Returns connect app to instance """
          return application.Application().connect(path="mmc.exe")
  
  
      app = connect_to_mmc()
      tree = app.mmc_main_frame.tree_view
      groups = tree.get_item(r'\Computer Management (Local)\System Tools\Local Users and Groups\Groups')
      groups.click()
      items = app.mmc_main_frame.list_view.items()
      print('\nGroups:')
      for i in range(len(items)):
          if i % 2 == 0:
              print(items[i].text())
      try:
          administrators = app.mmc_main_frame.list_view.get_item('Administrators')
          administrators.click(double=True)  # double click opens group properties
          app.dialog.wait('exists')
          items = app.dialog.list_view.items()
          print('\nAdministrators:')
          for element in items:
              print(element.text())
      except ValueError:
          print('\nThere is no Administrators group')
      app.kill_()
  else:
      print('\nYou are not administrator')
subject: print only group names