'Converts the credentials to a percent encoded string to be stored for
later use.
:returns:
:class:`string`'

def serialize(self):

    if (self.provider_id is None):
        raise ConfigError('To    serialize    credentials    you    need    to    specify    a    unique    integer    under    the    "id"    key    in    the    config    for    each    provider!')
    rest = self.provider_type_class().to_tuple(self)
    result = ((self.provider_id, self.provider_type_id) + rest)
    stringified = [str(i) for i in result]
    concatenated = '\n'.join(stringified)
    return parse.quote(concatenated, '')
