import base64


def unwrap(data):
    """
    Decode a formatted base64 keystring or an encrypted string.

    Arguments:
        data: Bytes to decode.

    Returns:
        The decoded input.
    """
    data = bytes([b for b in data if b not in b" \r\n"])
    return base64.b64decode(data)