def METHOD_NAME(
    string_to_validate: str, reference_type: str, context: ValidationContext
) -> List[ValidationMessage]:
    regex = TYPE_TO_REGEX[reference_type]
    if not re.match(regex, string_to_validate):
        return [
            ValidationMessage(
                f'externalPackageRef locator of type "{reference_type}" must conform with the regex {regex}, '
                f"but is: {string_to_validate}",
                context,
            )
        ]
    return []