from typing import Optional


def _basic_auth_credentials(source_parameters) -> Optional[tuple[str, str]]:
    """Return the basic authentication credentials, if any."""
    if private_token := source_parameters.get("private_token", ""):
        return private_token, ""
    username = source_parameters.get("username", "")
    password = source_parameters.get("password", "")
    return (username, password) if username and password else None