def parse_pdb_header(infile):
 header = []
 with File.as_handle(infile, 'r') as f:
  for l in f:
   record_type = l[0:6]
   if (record_type in ('ATOM  ', 'HETATM', 'MODEL ')):
    break
   else:
    header.append(l)
 return _parse_pdb_header_list(header)

def parse_pdb_header ( infile ) : header = [ ] with File . as_handle ( infile , 'r' ) as f : for l in f : record_type = l [ 0 : 6 ] if ( record_type in ( 'ATOM  ' , 'HETATM' , 'MODEL ' ) ) : break else : header . append ( l ) return _parse_pdb_header_list ( header )
returns the header lines of a pdb file as a dictionary .