'Serialize backup object, with optional extra info, into a string.'

def encode_record(self, **kwargs):

    record = {name: field.to_primitive(self, name, getattr(self, name)) for (name, field) in self.fields.items()}
    kwargs.update(record)
    retval = jsonutils.dump_as_bytes(kwargs)
    return base64.encode_as_text(retval)
