docs: def version(context=None):
      '''
      Attempts to run systemctl --version. Returns None if unable to determine
      version.
      '''
      contextkey = 'salt.utils.systemd.version'
      if isinstance(context, dict):
          # Can't put this if block on the same line as the above if block,
          # because it will break the elif below.
          if contextkey in context:
              return context[contextkey]
      elif context is not None:
          raise SaltInvocationError('context must be a dictionary if passed')
      stdout = subprocess.Popen(
          ['systemctl', '--version'],
          close_fds=True,
          stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
      outstr = salt.utils.stringutils.to_str(stdout)
      try:
          ret = int(re.search(r'\w+ ([0-9]+)', outstr.splitlines()[0]).group(1))
      except (AttributeError, IndexError, ValueError):
          log.error(
              'Unable to determine systemd version from systemctl '
              '--version, output follows:\n%s', outstr
          )
          return None
      else:
          try:
              context[contextkey] = ret
          except TypeError:
              pass
          return ret