def to_urlencoded(self, lev=<NUM_LIT:0>):
_spec = self.c_param<EOL>if not self.lax:<EOL><INDENT>for attribute, (_, req, _ser, _, na) in _spec.items():<EOL><INDENT>if req and attribute not in self._dict:<EOL><INDENT>raise MissingRequiredAttribute("<STR_LIT:%s>" % attribute,<EOL>"<STR_LIT:%s>" % self)<EOL><DEDENT><DEDENT><DEDENT>params = []<EOL>for key, val in self._dict.items():<EOL><INDENT>try:<EOL><INDENT>(_, req, _ser, _, null_allowed) = _spec[key]<EOL><DEDENT>except KeyError:  <EOL><INDENT>try:<EOL><INDENT>_key, lang = key.split("<STR_LIT:#>")<EOL>(_, req, _ser, _deser, null_allowed) = _spec[_key]<EOL><DEDENT>except (ValueError, KeyError):<EOL><INDENT>try:<EOL><INDENT>(_, req, _ser, _, null_allowed) = _spec['<STR_LIT:*>']<EOL><DEDENT>except KeyError:<EOL><INDENT>_ser = None<EOL>null_allowed = False<EOL><DEDENT><DEDENT><DEDENT>if val is None and null_allowed is False:<EOL><INDENT>continue<EOL><DEDENT>elif isinstance(val, str):<EOL><INDENT>params.append((key, val.encode("<STR_LIT:utf-8>")))<EOL><DEDENT>elif isinstance(val, list):<EOL><INDENT>if _ser:<EOL><INDENT>params.append((key, str(_ser(val, sformat="<STR_LIT>",<EOL>lev=lev))))<EOL><DEDENT>else:<EOL><INDENT>for item in val:<EOL><INDENT>params.append((key, str(item).encode('<STR_LIT:utf-8>')))<EOL><DEDENT><DEDENT><DEDENT>elif isinstance(val, Message):<EOL><INDENT>try:<EOL><INDENT>_val = json.dumps(_ser(val, sformat="<STR_LIT>", lev=lev + <NUM_LIT:1>))<EOL>params.append((key, _val))<EOL><DEDENT>except TypeError:<EOL><INDENT>params.append((key, val))<EOL><DEDENT><DEDENT>elif val is None:<EOL><INDENT>params.append((key, val))<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>params.append((key, _ser(val, lev=lev)))<EOL><DEDENT>except Exception:<EOL><INDENT>params.append((key, str(val)))<EOL><DEDENT><DEDENT><DEDENT>try:<EOL><INDENT>return urlencode(params)<EOL><DEDENT>except UnicodeEncodeError:<EOL><INDENT>_val = []<EOL>for k, v in params:<EOL><INDENT>try:<EOL><INDENT>_val.append((k, v.encode("<STR_LIT:utf-8>")))<EOL><DEDENT>except TypeError:<EOL><INDENT>_val.append((k, v))<EOL><DEDENT><DEDENT>return urlencode(_val)<EOL><DEDENT>
Creates a string using the application/x-www-form-urlencoded format

:return: A string of the application/x-www-form-urlencoded format