def _flatten_obj(self, obj):
    self._seen.append(obj)
    max_reached = self._max_reached()
    try:
        in_cycle = _in_cycle(obj, self._objs, max_reached, self.make_refs)
        if in_cycle:
            flatten_func = repr
        else:
            flatten_func = self._get_flattener(obj)
        if (flatten_func is None):
            self._pickle_warning(obj)
            return None
        return flatten_func(obj)
    except (KeyboardInterrupt, SystemExit) as e:
        raise e
    except Exception as e:
        if (self.fail_safe is None):
            raise e
        else:
            return self.fail_safe(e)
def _flatten_obj(self, obj):
    self._seen.append(obj)
    max_reached = self._max_reached()
    try:
        in_cycle = _in_cycle(obj, self._objs, max_reached, self.make_refs)
        if in_cycle:
            flatten_func = repr
        else:
            flatten_func = self._get_flattener(obj)
        if (flatten_func is None):
            self._pickle_warning(obj)
            return None
        return flatten_func(obj)
    except (KeyboardInterrupt, SystemExit) as e:
        raise e
    except Exception as e:
        if (self.fail_safe is None):
            raise e
        else:
            return self.fail_safe(e)