import re


def parse_time_offset(offset_str):
    """Parse a time offset."""
    match = re.split(r"([-+]?\s*\d*\.?\d+(?:[eE][-+]?\d+)?)\s*(\w*)", offset_str)
    scale = 1
    value = 0
    if len(match) == 4:
        value = float(match[1].replace(" ", ""))
        if match[2] == "m" or match[2] == "min" or match[2] == "minutes":
            scale = 60
        elif match[2] == "h" or match[2] == "hr" or match[2] == "hours":
            scale = 60 * 60
        elif match[2] == "d" or match[2] == "day" or match[2] == "days":
            scale = 60 * 60 * 24
        elif match[2] == "w" or match[2] == "week" or match[2] == "weeks":
            scale = 60 * 60 * 24 * 7
    return value * scale