import base64


def b64(inputStr):
    """
    Encode the string to its base64 value.
    """
    if inputStr is bytes:
        return base64.b64encode(inputStr)
    else:
        return base64.b64encode(inputStr.encode('utf-8'))