import base64


def encode(encoding_input):
    """This function converts a string to base64, and removes trailing ="""
    if (isinstance(encoding_input, str)):
        byte = str.encode(encoding_input)
    else:
        byte = encoding_input

    b64 = base64.urlsafe_b64encode(byte)
    res = b64.decode('utf-8')
    return res.replace('=', '')