def get_fileobj(byte_io):
 byte_io.seek(0)
 if zipfile.is_zipfile(byte_io):
  byte_io.seek(0)
  zf = zipfile.ZipFile(byte_io)
  filename = guess_zip_filename(zf)
  byte_io = zf.open(filename, mode='r')
 else:
  byte_io.seek(0)
 return io.TextIOWrapper(byte_io, encoding='utf-8')

def get_fileobj ( byte_io ) : byte_io . seek ( 0 ) if zipfile . is_zipfile ( byte_io ) : byte_io . seek ( 0 ) zf = zipfile . ZipFile ( byte_io ) filename = guess_zip_filename ( zf ) byte_io = zf . open ( filename , mode = 'r' ) else : byte_io . seek ( 0 ) return io . TextIOWrapper ( byte_io , encoding = 'utf-8' )
get a usable file object to read the hosts file from .