import base64


def b64decode(data: str, urlsafe: bool = False) -> str:
    """Accepts a string and returns the Base64 decoded representation of this string.
    `urlsafe=True` decodes urlsafe base64
    """
    if urlsafe:
        b64 = base64.urlsafe_b64decode(data.encode("ascii"))
        return b64.decode("ascii")
    b64 = base64.b64decode(data.encode("ascii"))
    return b64.decode("ascii")