human
Complete this python program:
def _future_expose_api(func, to_json=True, user_required=True, user_or_session_required=True, handle_jsonp=True):
assistant
#Here is the Python code you requested.

    """Expose this function via the API.
    """
    @wraps(func)
    def decorator(self, trans, *args, **kwargs):
        if trans.error_message:
            return __api_error_response(trans, status_code=403, err_code=error_codes.USER_NO_API_KEY, err_msg=trans.error_message)
        if trans.anonymous:
            if user_required:
                return __api_error_response(trans, status_code=403, err_code=error_codes.USER_NO_API_KEY, err_msg='API    authentication    required    for    this    request')
            if ((not trans.galaxy_session) and user_or_session_required):
                return __api_error_response(trans, status_code=403, err_code=error_codes.USER_NO_API_KEY, err_msg='API    authentication    required    for    this    request')
        if trans.request.body:
            try:
                kwargs['payload'] = __extract_payload_from_request(trans, func, kwargs)
            except ValueError:
                error_code = error_codes.USER_INVALID_JSON
                return __api_error_response(trans, status_code=400, err_code=error_code)
        jsonp_callback = (kwargs.pop(JSONP_CALLBACK_KEY, None) if handle_jsonp else None)
        if jsonp_callback:
            trans.response.set_content_type(JSONP_CONTENT_TYPE)
        else:
            trans.response.set_content_type(JSON_CONTENT_TYPE)
        trans.response.headers['Cache-Control'] = 'max-age=0,no-cache,no-store'
        if (('payload' in kwargs) and ('run_as' in kwargs['payload'])):
            if (not trans.user_can_do_run_as()):
                error_code = error_codes.USER_CANNOT_RUN_AS
                return __api_error_response(trans, err_code=error_code, status_code=403)
            try:
                decoded_user_id = trans.security.decode_id(kwargs['payload']['run_as'])
            except TypeError:
                error_message = ('Malformed    user    id    (    %s    )    specified,    unable    to    decode.' % str(kwargs['payload']['run_as']))
                error_code = error_codes.USER_INVALID_RUN_AS
                return __api_error_response(trans,...