import re


def get_scale_fs(timescale):
    """Convert sdf timescale to scale factor to femtoseconds as int

    >>> get_scale_fs('1.0 fs')
    1

    >>> get_scale_fs('1ps')
    1000

    >>> get_scale_fs('10 ns')
    10000000

    >>> get_scale_fs('10.0 us')
    10000000000

    >>> get_scale_fs('100.0ms')
    100000000000000

    >>> get_scale_fs('100 s')
    100000000000000000

    >>> try:
    ...     get_scale_fs('2s')
    ... except AssertionError as e:
    ...     print(e)
    Invalid SDF timescale 2s

    """
    mm = re.match(r'(10{0,2})(\.0)? *([munpf]?s)', timescale)
    sc_lut = {
        's': 1e15,
        'ms': 1e12,
        'us': 1e9,
        'ns': 1e6,
        'ps': 1e3,
        'fs': 1,
    }
    assert mm is not None, "Invalid SDF timescale {}".format(timescale)

    base, _, sc = mm.groups()
    return int(base) * int(sc_lut[sc])