code: def parse_keytab(keytab):
      
      try:
          out = subprocess.check_output(['klist', '-k', keytab],
                                        stderr=subprocess.PIPE)
      except OSError:
          raise KerberosError("Failed to locate klist, cannot read keytab")
      except subprocess.CalledProcessError:
          raise KerberosError("Cannot read keytab {!r}".format(keytab))
      principals = []
      for line in out.splitlines():
          if isinstance(line, bytes):
              line = line.decode('utf-8')
          try:
              kvno, principal, = re.split(r'\s+', line.strip(' '), 1)
          except ValueError:
              continue
          else:
              if not kvno.isdigit():
                  continue
              principals.append(tuple(principal.split('@')) + (int(kvno),))
      # return unique, ordered list
      return list(OrderedDict.fromkeys(principals).keys())
docs: Read the contents of a KRB5 keytab file, returning a list of
      credentials listed within
  
      Parameters
      ----------
      keytab : `str`
          path to keytab file
  
      Returns
      -------
      creds : `list` of `tuple`
          the (unique) list of `(username, realm, kvno)` as read from the
          keytab file
  
      Examples
      --------
      >>> from gwpy.io.kerberos import parse_keytab
      >>> print(parse_keytab("creds.keytab"))
      [('albert.einstein', 'LIGO.ORG', 1)]