def gpi_iterator(handle):
 inline = handle.readline()
 if (inline.strip() == '!gpi-version: 1.1'):
  return _gpi11iterator(handle)
 elif (inline.strip() == '!gpi-version: 1.0'):
  return _gpi10iterator(handle)
 elif (inline.strip() == '!gpi-version: 2.1'):
  return _gpi20iterator(handle)
 else:
  raise ValueError('Unknown GPI version {0}\n'.format(inline))

def gpi_iterator ( handle ) : inline = handle . readline ( ) if ( inline . strip ( ) == '!gpi-version: 1.1' ) : return _gpi11iterator ( handle ) elif ( inline . strip ( ) == '!gpi-version: 1.0' ) : return _gpi10iterator ( handle ) elif ( inline . strip ( ) == '!gpi-version: 2.1' ) : return _gpi20iterator ( handle ) else : raise ValueError ( 'Unknown GPI version {0}\n' . format ( inline ) )
read gpi format files .