class_docstr:     A class for temporarily setting the global handler for when you can't explicitly call load_with_extra
      (because it's not your code making the torch.load call). The intended use is like this:
  
  ```
  import torch
  from modules import safe
  
  def handler(module, name):
      if module == 'torch' and name in ['float64', 'float16']:
          return getattr(torch, name)
  
      return None
  
  with safe.Extra(handler):
      x = torch.load('model.pt')
  ```
      
class_docstr_tok: ["A","class","for","temporarily","setting","the","global","handler","for","when","you","ca","n't","explicitly","call","load_with_extra","(","because","it","'s","not","your","code","making","the","torch.load","call",")",".","The","intended","use","is","like","this",":","``","`","import","torch","from","modules","import","safe","def","handler","(","module",",","name",")",":","if","module","==","'torch","'","and","name","in","[","'float64","'",",","'float16","'","]",":","return","getattr","(","torch",",","name",")","return","None","with","safe.Extra","(","handler",")",":","x","=","torch.load","(","'model.pt","'",")","``","`"]
code: def __enter__(self):
      global global_extra_handler
  
      assert (
          global_extra_handler is None
      ), "already inside an Extra() block"
      global_extra_handler = self.handler
  
imports: import pickle
  import collections
  import torch
  import numpy
  import _codecs
  import zipfile
  import re
  from modules import errors
label_desc: Use image node_id 2 for calling the Extra obj's underlying member method code with example usage: obj.__enter__() without return types