import base64


def encode(s):
    """encode string with base64 algorithm

    Arguments:
        s (string) : the string will be encoded

    Returns:
        bytes : the encoded bytes
    """
    if isinstance(s, str):
        b = s.encode()
    else:
        b = s
    return base64.b64encode(b)