def METHOD_NAME(
    cls,
    details: Dict[str, str],
    storage_type: str,
) -> Dict[str, str]:
    """
    Validates the provided storage details field given the storage type.
    Abstracts out the pydantic input parameters to make the validation logic more reusable.
    """
    try:
        schema = {
            StorageType.s3.value: StorageDetailsS3,
            StorageType.local.value: StorageDetailsLocal,
        }[storage_type]
    except KeyError:
        raise ValueError(
            f"`storage_type` {storage_type} has no supported `details` validation."
        )
    try:
        schema.parse_obj(details)  # type: ignore
    except ValidationError as exc:
        # Pydantic requires validators raise either a ValueError, TypeError, or AssertionError
        # so this exception is cast into a `ValueError`.
        errors = [f"{err['msg']} {str(err['loc'])}" for err in exc.errors()]
        raise ValueError(errors)
    return details