def segment_range_to_fragment_range(segment_start, segment_end, segment_size, fragment_size):
 fragment_start = (((segment_start / segment_size) * fragment_size) if (segment_start is not None) else None)
 fragment_end = (None if (segment_end is None) else ((((segment_end + 1) / segment_size) * fragment_size) if (segment_start is None) else ((((segment_end + 1) / segment_size) * fragment_size) - 1)))
 return (fragment_start, fragment_end)

def segment_range_to_fragment_range ( segment_start , segment_end , segment_size , fragment_size ) : fragment_start = ( ( ( segment_start / segment_size ) * fragment_size ) if ( segment_start is not None ) else None ) fragment_end = ( None if ( segment_end is None ) else ( ( ( ( segment_end + 1 ) / segment_size ) * fragment_size ) if ( segment_start is None ) else ( ( ( ( segment_end + 1 ) / segment_size ) * fragment_size ) - 1 ) ) ) return ( fragment_start , fragment_end )
takes a byterange spanning some segments and converts that into a byterange spanning the corresponding fragments within their fragment archives .