def METHOD_NAME(  # type: ignore[override]
    cls,
    config: Dict[str, str],
    environment: AwsEnvironment,
    verify: bool = True,
) -> "ElasticContainerRegistry":
    """Create an Elastic Container Registry from a config.
    Arguments:
        config (dict): The config.
        environment (AwsEnvironment): The AWS environment.
    Returns:
        ElasticContainerRegistry: The Elastic Container Registry.
    """
    if config.get("type") != "ecr":
        raise LaunchError(
            f"Could not create ElasticContainerRegistry from config. Expected type 'ecr' "
            f"but got '{config.get('type')}'."
        )
    if ("uri" in config) == ("repository" in config):
        raise LaunchError(
            "Could not create ElasticContainerRegistry from config. Either 'uri' or "
            f"'repository' is required. The config received was:\n{yaml.dump(config)}."
        )
    if "repository" in config:
        repository = config.get("repository")
    else:
        match = re.match(
            r"^(?P<account>.*)\.dkr\.ecr\.(?P<region>.*)\.amazonaws\.com/(?P<repository>.*)/?$",
            config["uri"],
        )
        if not match:
            raise LaunchError(
                f"Could not create ElasticContainerRegistry from config. The uri "
                f"{config.get('uri')} is invalid."
            )
        repository = match.group("repository")
        if match.group("region") != environment.region:
            raise LaunchError(
                f"Could not create ElasticContainerRegistry from config. The uri "
                f"{config.get('uri')} is in region {match.group('region')} but the "
                f"environment is in region {environment.region}."
            )
        if match.group("account") != environment._account:
            raise LaunchError(
                f"Could not create ElasticContainerRegistry from config. The uri "
                f"{config.get('uri')} is in account {match.group('account')} but the "
                f"account being used is {environment._account}."
            )
    if not isinstance(repository, str):
        # This is for mypy. We should never get here.
        raise LaunchError(
            f"Could not create ElasticContainerRegistry from config. The repository "
            f"{repository} is invalid: repository should be a string."
        )
    return cls(repository, environment)