<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def store(self, obj, distinct=False):
        '''
        Store an object in the table.

        :param obj: An object to store
        :param distinct: Store object only if there is none identical of such.
                          If at least one field is different, store it.
        :return:
        '''
        if distinct:
            fields = dict(zip(self._tables[obj._TABLE].keys(),
                              obj._serialize(self._tables[obj._TABLE])))
            db_obj = self.get(obj.__class__, eq=fields)
            if db_obj and distinct:
                raise Exception("Object already in the database.")
        with gzip.open(os.path.join(self.db_path, obj._TABLE), 'a') as table:
            csv.writer(table).writerow(self._validate_object(obj))