def truncate(endpoint):
    """
    Truncates endpoint to return only last three strings of endpoint
    Ex:
    For endpoint https://aaa.bb.com/dd/ee/ff/gg?input1=test, returns "/ee/ff/gg"
    """
    __endpoint_strs = endpoint.rsplit('?')[0].rsplit('/')
    __truncated_endpoint = '/{}/{}/{}'.format(__endpoint_strs[-3], __endpoint_strs[-2], __endpoint_strs[-1])
    return __truncated_endpoint