code: def encode(self, name, as_map_key=False):
          
          if name in self.key_to_value:
              return self.key_to_value[name]
          return self.encache(name) if is_cacheable(name, as_map_key) else name
docs: Returns the name the first time and the key after that