def bisect_find_sha(start, end, sha, unpack_name):
 assert (start <= end)
 while (start <= end):
  i = ((start + end) // 2)
  file_sha = unpack_name(i)
  if (file_sha < sha):
   start = (i + 1)
  elif (file_sha > sha):
   end = (i - 1)
  else:
   return i
 return None

def bisect_find_sha ( start , end , sha , unpack_name ) : assert ( start <= end ) while ( start <= end ) : i = ( ( start + end ) // 2 ) file_sha = unpack_name ( i ) if ( file_sha < sha ) : start = ( i + 1 ) elif ( file_sha > sha ) : end = ( i - 1 ) else : return i return None
find a sha in a data blob with sorted shas .