code: def signextend(computation: BaseComputation) -> None:
      
      bits, value = computation.stack_pop(num_items=2, type_hint=constants.UINT256)
  
      if bits <= 31:
          testbit = bits * 8 + 7
          sign_bit = (1 << testbit)
          if value & sign_bit:
              result = value | (constants.UINT_256_CEILING - sign_bit)
          else:
              result = value & (sign_bit - 1)
      else:
          result = value
  
      computation.stack_push(result)
docs: Signed Extend