def is_byte_range_valid(start, stop, length):
 if ((start is None) != (stop is None)):
  return False
 elif (start is None):
  return ((length is None) or (length >= 0))
 elif (length is None):
  return (0 <= start < stop)
 elif (start >= stop):
  return False
 return (0 <= start < length)

def is_byte_range_valid ( start , stop , length ) : if ( ( start is None ) != ( stop is None ) ) : return False elif ( start is None ) : return ( ( length is None ) or ( length >= 0 ) ) elif ( length is None ) : return ( 0 <= start < stop ) elif ( start >= stop ) : return False return ( 0 <= start < length )
checks if a given byte content range is valid for the given length .