def xmlFile(path, mode='r'):
 fh = file(path, mode)
 while (fh.read(1) != '<'):
  pass
 fh.seek((-1), 1)
 return fh

def xmlFile ( path , mode = 'r' ) : fh = file ( path , mode ) while ( fh . read ( 1 ) != '<' ) : pass fh . seek ( ( - 1 ) , 1 ) return fh
lxml cannot parse xml files starting with a bom in case such xml file is used .