def parse_period(fragments):
    """
    Given the split up characteristic, return the period in milliseconds

    The period is specified in seconds

    >>> parse_period(['2'])
    2000

    The letter 's' to mark the units may be present

    >>> parse_period(['3s'])
    3000

    It may be separated from the number by a space

    >>> parse_period(['4','s'])
    4000

    A Quick flash can only have a period if it has groups

    >>> parse_period(['3s'])
    3000
    """
    period_spec = fragments[-1]
    # The last term is the cycle period,
    # it may or may not have 's' for seconds
    # The 's' may or may not be attached to the number
    if period_spec == 's':
        period_spec = fragments[-2]
    if period_spec[-1] == 's':
        period_spec = period_spec[:-1]
    return int(float(period_spec) * 1000)