def get_subsecond_component(frac_seconds, frac_seconds_exponent,
                            subsec_component_exponent, upper_exponent_limit):
    """Return the number of subseconds from frac_seconds *
    (10**frac_seconds_exponent) corresponding to subsec_component_exponent that
    does not exceed upper_exponent_limit.

    For example:
    If frac_seconds*(10**frac_seconds_exponent) is 0.1234567,
    upper_exponent_limit is SITimeUnit.SECONDS, and subsec_component_exponent is
    SITimeUnit.MICROSECONDS, 123456 would be returned.

    If frac_seconds*(10**frac_seconds_exponent) is 0.123456789,
    upper_exponent_limit is SITimeUnit.MICROSECONDS, and
    subsec_component_exponent is SITimeUnit.NANOSECONDS, 789 would be returned.

    Same example as above, but with upper_exponent_limit = SITimeUnit.SECONDS,
    123456789 would be returned.
    """
    total_subsecs = int(frac_seconds * (10 ** (frac_seconds_exponent -
                                               subsec_component_exponent)))
    return total_subsecs % (10 ** abs(subsec_component_exponent -
                                      upper_exponent_limit))