def METHOD_NAME(key_string: str) -> _RSAPrivateKey:
    """
    Load a private key from a string, which may be base64 encoded.
    Parameters
    ----------
    key_string : str
        String containing the key, optionally base64 encoded
    Returns
    -------
    _RSAPrivateKey
        The private key
    """
    try:
        return serialization.load_pem_private_key(
            key_string.encode(), password=None, backend=default_backend()
        )
    except ValueError:
        try:
            return METHOD_NAME(base64.b64decode(key_string).decode())
        except (binhex.Error, ValueError):
            raise ValueError("Failed to load private key.")