code: def pop(self, ty=None, val=None):
      token = self.tokens[self.idx]
  
      assert check_type(token, ty, val), f"Expected {ty}, got {token}."
  
      self.idx += 1
      return token
  
imports: import re
  from dataclasses import dataclass, InitVar, field
  from itertools import chain
  from typing import Any, Dict, List, Union, Optional, ClassVar
  import numpy
  from toolz import valfilter, valmap
label_desc: Use image node_id 2 for calling the TokenStream obj's underlying member method code with example usage: obj.pop(ty, val) and returns: token