code: def check_output_and_strip(cmd):  # type: (List[Text]) -> Optional[Text]
      
      try:
          result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
          return result.strip()
      except (OSError, subprocess.CalledProcessError, TypeError, AttributeError):
          # OSError is raised if command doesn't exist
          # CalledProcessError is raised if command returns nonzero
          # AttributeError is raised if result cannot be strip()ped
          return None
docs: Passes a command list to subprocess.check_output, returning None
      if an expected exception is raised
      :param cmd: The command to execute
      :return: Stripped string output of the command, or None if error