docs: def __op(name, val, fmt=None, const=False, consume=0, produce=0):
      """
      provides sensible defaults for a code, and registers it with the
      __OPTABLE for lookup.
      """
  
      name = name.lower()
  
      # fmt can either be a str representing the struct to unpack, or a
      # callable to do more complex unpacking. If it's a str, create a
      # callable for it.
      if isinstance(fmt, str):
          fmt = partial(_unpack, compile_struct(fmt))
  
      operand = (name, val, fmt, consume, produce, const)
  
      assert(name not in __OPTABLE)
      assert(val not in __OPTABLE)
  
      __OPTABLE[name] = operand
      __OPTABLE[val] = operand
  
      return val