<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _update_tokens_from_swap_format(self, original_format, original_format_order, remove_obsolete=True):
 """ Updates tokens based on a swap format call that will maintain synchronicity between token_dict and attrs If there was an accidental setting already set to one of the attrs that should now be a token attr due to the format swap, we wipe it and add a new TokenAttr to the Nomenclate attribute. :param original_format: str, original format string to compare to :param original_format_order: list(str), the original format order to compare to :param remove_obsolete: bool, whether to remove obsolete tokens if off: persistent state across format swaps of missing tokens """

        old_format_order = [_.lower() for _ in original_format_order]
        new_format_order = [_.lower() for _ in self.format_order]
        if hasattr(self, 'token_dict') and self.format != original_format:
            old_tokens = [token for token in list(set(old_format_order) - set(new_format_order))
                          if hasattr(self, token)]

            new_tokens = [token for token in set(new_format_order) - set(old_format_order)
                          if not hasattr(self, token) or isinstance(getattr(self, token, ''), str)]

            self.merge_dict(dict.fromkeys(new_tokens, ''))

            if remove_obsolete:
                self.token_dict.purge_tokens(old_tokens)

                for new_token in new_tokens:
                    try:
                        delattr(self, new_token)
                    except AttributeError:
                        pass