def _get_pseudo_pgp_block(remaining_contents):
 if (not remaining_contents):
  return None
 block_match = PGP_BLOCK_START.match(remaining_contents[0])
 if block_match:
  block_type = block_match.groups()[0]
  block_lines = []
  end_line = (PGP_BLOCK_END % block_type)
  while True:
   if (not remaining_contents):
    raise ValueError(("Unterminated pgp style block (looking for '%s'):\n%s" % (end_line, '\n'.join(block_lines))))
   line = remaining_contents.pop(0)
   block_lines.append(line)
   if (line == end_line):
    return (block_type, '\n'.join(block_lines))
 else:
  return None

def _get_pseudo_pgp_block ( remaining_contents ) : if ( not remaining_contents ) : return None block_match = PGP_BLOCK_START . match ( remaining_contents [ 0 ] ) if block_match : block_type = block_match . groups ( ) [ 0 ] block_lines = [ ] end_line = ( PGP_BLOCK_END % block_type ) while True : if ( not remaining_contents ) : raise ValueError ( ( "Unterminated pgp style block (looking for '%s'):\n%s" % ( end_line , '\n' . join ( block_lines ) ) ) ) line = remaining_contents . pop ( 0 ) block_lines . append ( line ) if ( line == end_line ) : return ( block_type , '\n' . join ( block_lines ) ) else : return None
checks if given contents begins with a pseudo-open-pgp-style block and .