def drain(file_like, read_size, timeout):
 while True:
  with ChunkReadTimeout(timeout):
   chunk = file_like.read(read_size)
   if (not chunk):
    break

def drain ( file_like , read_size , timeout ) : while True : with ChunkReadTimeout ( timeout ) : chunk = file_like . read ( read_size ) if ( not chunk ) : break
read and discard any bytes from file_like .