<s> from __future__ import absolute_import , unicode_literals , division <EOL> import six <EOL> from . base import Serializer <EOL> from armet import media_types <EOL> if six . PY3 : <EOL> from urllib . parse import urlencode <EOL> else : <EOL> from urllib import urlencode <EOL> class URLSerializer ( Serializer ) : <EOL> media_types = media_types . URL <EOL> def serialize ( self , obj = None ) : <EOL> if obj is None : <EOL> return '<STR_LIT>' <EOL> try : <EOL> return super ( URLSerializer , self ) . serialize ( urlencode ( obj , True ) ) <EOL> except TypeError : <EOL> raise ValueError </s>
