<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_primitive(self, load_rels=None, sparse_fields=None, *args, **kwargs):
 """ Override the schematics native to_primitive method :param loads_rels: List of field names that are relationships that should be loaded for the serialization process. This needs to be run before the native schematics to_primitive is run so the proper data is serialized. :param sparse_fields: List of field names that can be provided which limits the serialization to ONLY those field names. A whitelist effectively. """


        if load_rels:
            for rel in load_rels:
                getattr(self, rel).load()

        data = super(Model, self).to_primitive(*args, **kwargs)

        if sparse_fields:
            for key in data.keys():
                if key not in sparse_fields:
                    del data[key]

        return data