def is_pem_private(pem, keytype='<STR_LIT>'):
<EOL>securesystemslib.formats.PEMRSA_SCHEMA.check_match(pem)<EOL>securesystemslib.formats.NAME_SCHEMA.check_match(keytype)<EOL>if keytype == '<STR_LIT>':<EOL><INDENT>pem_header = '<STR_LIT>'<EOL>pem_footer = '<STR_LIT>'<EOL><DEDENT>elif keytype == '<STR_LIT>':<EOL><INDENT>pem_header = '<STR_LIT>'<EOL>pem_footer = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>raise securesystemslib.exceptions.FormatError('<STR_LIT>'<EOL>'<STR_LIT>' + repr(keytype) + '<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>header_start = pem.index(pem_header)<EOL>pem.index(pem_footer, header_start + len(pem_header))<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>
<Purpose>
  Checks if a passed PEM formatted string is a PRIVATE key, by looking for
  the following patterns:

  '-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----'
  '-----BEGIN EC PRIVATE KEY----- ... -----END EC PRIVATE KEY-----'

  >>> rsa_key = generate_rsa_key()
  >>> private = rsa_key['keyval']['private']
  >>> public = rsa_key['keyval']['public']
  >>> is_pem_private(private)
  True
  >>> is_pem_private(public)
  False

<Arguments>
  pem:
    A string in PEM format.

<Exceptions>
  securesystemslib.exceptions.FormatError, if any of the arguments are
  improperly formatted.

<Side Effects>
  None

<Returns>
  True if 'pem' is private and false otherwise.