nodes: 0, module; 1, function_definition; 2, function_name:url_params; 3, parameters; 4, block; 5, identifier:request; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, for_statement; 12, if_statement; 13, return_statement; 14, identifier:except_params; 15, None; 16, identifier:as_is; 17, False; 18, comment:"""
      create string with GET-params of request
  
      usage example:
          c['sort_url'] = url_params(request, except_params=('sort',))
          ...
          <a href="{{ sort_url }}&sort=lab_number">Лабораторный номер</a>
      """; 19, not_operator; 20, block; 21, assignment; 22, pattern_list; 23, call; 24, block; 25, identifier:as_is; 26, block; 27, else_clause; 28, call; 29, attribute; 30, return_statement; 31, identifier:params; 32, list; 33, identifier:key; 34, identifier:value; 35, attribute; 36, argument_list; 37, if_statement; 38, expression_statement; 39, block; 40, identifier:mark_safe; 41, argument_list; 42, identifier:request; 43, identifier:GET; 44, string; 45, attribute; 46, identifier:items; 47, boolean_operator; 48, block; 49, assignment; 50, expression_statement; 51, expression_statement; 52, identifier:str_params; 53, identifier:request; 54, identifier:GET; 55, identifier:except_params; 56, comparison_operator:key not in except_params; 57, for_statement; 58, identifier:str_params; 59, binary_operator:'?' + '&'.join(params); 60, assignment; 61, assignment; 62, identifier:key; 63, identifier:except_params; 64, identifier:v; 65, call; 66, block; 67, string; 68, call; 69, identifier:str_params; 70, binary_operator:'?' + '&'.join(params); 71, identifier:str_params; 72, call; 73, attribute; 74, argument_list; 75, expression_statement; 76, string_content:?; 77, attribute; 78, argument_list; 79, string; 80, call; 81, identifier:urlquote; 82, argument_list; 83, attribute; 84, identifier:getlist; 85, identifier:key; 86, call; 87, string; 88, identifier:join; 89, identifier:params; 90, string_content:?; 91, attribute; 92, argument_list; 93, identifier:str_params; 94, identifier:request; 95, identifier:GET; 96, attribute; 97, argument_list; 98, string_content:&; 99, string; 100, identifier:join; 101, identifier:params; 102, identifier:params; 103, identifier:append; 104, binary_operator:'%s=%s' % (key, urlquote(v)); 105, string_content:&; 106, string; 107, tuple; 108, string_content:%s=%s; 109, identifier:key; 110, call; 111, identifier:urlquote; 112, argument_list; 113, identifier:v
code: def url_params(request, except_params=None, as_is=False):
      """
      create string with GET-params of request
  
      usage example:
          c['sort_url'] = url_params(request, except_params=('sort',))
          ...
          <a href="{{ sort_url }}&sort=lab_number">Лабораторный номер</a>
      """
      if not request.GET:
          return ''
      params = []
      for key, value in request.GET.items():
          if except_params and key not in except_params:
              for v in request.GET.getlist(key):
                  params.append('%s=%s' % (key, urlquote(v)))
  
      if as_is:
          str_params = '?' + '&'.join(params)
      else:
          str_params = '?' + '&'.join(params)
          str_params = urlquote(str_params)
      return mark_safe(str_params)