def _generate_route_helper(self, namespace, route, download_to_file=False):
arg_data_type = route.arg_data_type<EOL>result_data_type = route.result_data_type<EOL>request_binary_body = route.attrs.get('<STR_LIT>') == '<STR_LIT>'<EOL>response_binary_body = route.attrs.get('<STR_LIT>') == '<STR_LIT>'<EOL>if download_to_file:<EOL><INDENT>assert response_binary_body, '<STR_LIT>''<STR_LIT>'<EOL>self._generate_route_method_decl(namespace,<EOL>route,<EOL>arg_data_type,<EOL>request_binary_body,<EOL>method_name_suffix='<STR_LIT>',<EOL>extra_args=['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>self._generate_route_method_decl(namespace,<EOL>route,<EOL>arg_data_type,<EOL>request_binary_body)<EOL><DEDENT>with self.indent():<EOL><INDENT>extra_request_args = None<EOL>extra_return_arg = None<EOL>footer = None<EOL>if request_binary_body:<EOL><INDENT>extra_request_args = [('<STR_LIT:f>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>')]<EOL><DEDENT>elif download_to_file:<EOL><INDENT>extra_request_args = [('<STR_LIT>',<EOL>'<STR_LIT:str>',<EOL>'<STR_LIT>')]<EOL><DEDENT>if response_binary_body and not download_to_file:<EOL><INDENT>extra_return_arg = '<STR_LIT>'<EOL>footer = DOCSTRING_CLOSE_RESPONSE<EOL><DEDENT>if route.doc:<EOL><INDENT>func_docstring = self.process_doc(route.doc, self._docf)<EOL><DEDENT>else:<EOL><INDENT>func_docstring = None<EOL><DEDENT>self._generate_docstring_for_func(<EOL>namespace,<EOL>arg_data_type,<EOL>result_data_type,<EOL>route.error_data_type,<EOL>overview=func_docstring,<EOL>extra_request_args=extra_request_args,<EOL>extra_return_arg=extra_return_arg,<EOL>footer=footer,<EOL>)<EOL>self._maybe_generate_deprecation_warning(route)<EOL>if is_void_type(arg_data_type):<EOL><INDENT>self.emit('<STR_LIT>')<EOL><DEDENT>elif is_struct_type(arg_data_type):<EOL><INDENT>self.generate_multiline_list(<EOL>[f.name for f in arg_data_type.all_fields],<EOL>before='<STR_LIT>'.format(<EOL>fmt_namespace(arg_data_type.namespace.name),<EOL>fmt_class(arg_data_type.name)),<EOL>)<EOL><DEDENT>elif not is_union_type(arg_data_type):<EOL><INDENT>raise AssertionError('<STR_LIT>' %<EOL>arg_data_type)<EOL><DEDENT>args = [<EOL>'<STR_LIT>'.format(fmt_namespace(namespace.name),<EOL>fmt_func(route.name, version=route.version)),<EOL>"<STR_LIT>".format(namespace.name),<EOL>'<STR_LIT>']<EOL>if request_binary_body:<EOL><INDENT>args.append('<STR_LIT:f>')<EOL><DEDENT>else:<EOL><INDENT>args.append('<STR_LIT:None>')<EOL><DEDENT>self.generate_multiline_list(args, '<STR_LIT>', compact=False)<EOL>if download_to_file:<EOL><INDENT>self.emit('<STR_LIT>')<EOL>if is_void_type(result_data_type):<EOL><INDENT>self.emit('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>self.emit('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if is_void_type(result_data_type):<EOL><INDENT>self.emit('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>self.emit('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>self.emit()<EOL>
Generate a Python method that corresponds to a route.

        :param namespace: Namespace that the route belongs to.
        :param stone.ir.ApiRoute route: IR node for the route.
        :param bool download_to_file: Whether a special version of the route
            that downloads the response body to a file should be generated.
            This can only be used for download-style routes.