import re


def parse_timezone(timezone: str) -> float:
    """Parse timezone to offset."""
    match = re.match(
        r"^(?P<sign>[-+])(?P<hours>\d{1,2}):(?P<minutes>\d{1,2})$", timezone
    )
    if match:
        if match.group("sign") == "-":
            sign = -1.0
        else:
            sign = 1.0
        return sign * (int(match.group("hours")) + (int(match.group("minutes")) / 60.0))
    raise Exception(f"Unknown timezone format: {timezone}")