def _open_for_random_access(filename):
 handle = open(filename, 'rb')
 from . import bgzf
 try:
  return bgzf.BgzfReader(mode='rb', fileobj=handle)
 except ValueError as e:
  assert ('BGZF' in str(e))
  handle.seek(0)
 return handle

def _open_for_random_access ( filename ) : handle = open ( filename , 'rb' ) from . import bgzf try : return bgzf . BgzfReader ( mode = 'rb' , fileobj = handle ) except ValueError as e : assert ( 'BGZF' in str ( e ) ) handle . seek ( 0 ) return handle
open a file in binary mode .