code: def interpolate(text, global_dict=None, local_dict=None):
      '''Evaluate expressions in `text` '''
      # step 1, make it a f-string (add quotation marks and f
      # step 2, evaluate as a string
      try:
          return eval(as_fstring(text), global_dict, local_dict)
      except Exception as e:
          raise ValueError(f'Failed to interpolate {text}: {e}'f interpolate(text, global_dict=None, local_dict=None):
      '''Evaluate expressions in `text` '''
      # step 1, make it a f-string (add quotation marks and f
      # step 2, evaluate as a string
      try:
          return eval(as_fstring(text), global_dict, local_dict)
      except Exception as e:
          raise ValueError(f'Failed to interpolate {text}: {e}')
docs: Evaluate expressions in `text`