def METHOD_NAME(line: str) -> ContentFilter:
    arrow_idx = line.find("=>")
    if arrow_idx < 0:
        raise InvalidFilterException("cannot find separator '=>'")
    pkg_pattern = line[:arrow_idx].strip()
    action_str = line[arrow_idx + 2:].strip()
    action = action_str[0]
    args: List[str] = []
    remove_before = 0
    remove_after = 0
    if action == "d" or action == "D":
        # actions with one argument and possibly numbers that indicate lines to remove after/before
        slash_idx = action_str.find("/")
        skip_before_match = re.search(r'\-(\d+)', action_str)
        skip_after_match = re.search(r'\+(\d+)', action_str)
        remove_before = 0 if not skip_before_match else int(skip_before_match.group(1))
        remove_after = 0 if not skip_after_match else int(skip_after_match.group(1))
        if slash_idx < 0:
            raise InvalidFilterException("cannot find separator '/'")
        args.append(action_str[slash_idx + 1:])
    elif action == "r" or action == "R" or action == "s":
        # actions with two arguments
        slash0_idx = action_str.find("/")
        slash1_idx = action_str.find("/", slash0_idx + 1)
        while slash1_idx > 0 and action_str[slash1_idx - 1] == '\\':
            slash1_idx = action_str.find("/", slash1_idx + 1)
        if slash0_idx < 0:
            raise InvalidFilterException("cannot find first separator '/'")
        if slash1_idx < 0:
            raise InvalidFilterException("cannot find second separator '/'")
        args.append(action_str[slash0_idx + 1:slash1_idx])
        args.append(action_str[slash1_idx + 1:])
    else:
        raise InvalidFilterException("invalid action '" + action_str + "'")
    return ContentFilter(pkg_pattern, action, args, remove_before, remove_after)