def METHOD_NAME(data: str, password: Optional[Union[bytes, str]]) -> str:
    if password is None:
        return data
    secret = sha256d(password)
    try:
        d = to_string(DecodeAES_base64(secret, data), "utf8")
    except Exception:
        raise InvalidPassword()
    return d