def client_range_to_segment_range(client_start, client_end, segment_size):
 segment_start = ((int((client_start // segment_size)) * segment_size) if (client_start is not None) else None)
 segment_end = (None if (client_end is None) else ((((int((client_end // segment_size)) + 1) * segment_size) - 1) if (client_start is not None) else (int(math.ceil(((float(client_end) / segment_size) + 1))) * segment_size)))
 return (segment_start, segment_end)

def client_range_to_segment_range ( client_start , client_end , segment_size ) : segment_start = ( ( int ( ( client_start // segment_size ) ) * segment_size ) if ( client_start is not None ) else None ) segment_end = ( None if ( client_end is None ) else ( ( ( ( int ( ( client_end // segment_size ) ) + 1 ) * segment_size ) - 1 ) if ( client_start is not None ) else ( int ( math . ceil ( ( ( float ( client_end ) / segment_size ) + 1 ) ) ) * segment_size ) ) ) return ( segment_start , segment_end )
takes a byterange from the client and converts it into a byterange spanning the necessary segments .