def METHOD_NAME(component_type: str, value: Any) -> date | datetime:
    match [value, component_type]:
        case [datetime(), "date"]:
            assert (
                value.tzinfo is not None
            ), "Expected the input variable to be timezone aware!"
            return timezone.localtime(value=value).date()
        case [date(), "date"]:
            return value
        case [str(), "date"]:
            # attempt to parse it as a date/datetime - could be because the variable
            # was not properly typed and type conversion didn't happen.
            # This can raise ValueError if the string is gibberish.
            return parse_date(value)
        case [datetime(), "datetime"]:
            return value
        case [str(), "datetime"]:
            parsed_value = parse_datetime(value)
            if not parsed_value:
                raise ValueError("Could not parse %s as a datetime" % value)
            return parsed_value
    raise ValueError(
        "Unexpected type encountered when processing min/max validation for %s component."
        % component_type
    )