def fake_encode(input):
     if "result" in input:
         raise InternalError("Could not parse the input data.")
     else:
         return original_encode(input)
 def custom_encode(input):
     if "result" in input and input["id"] == "foo":
         raise InternalError("Could not parse the input data.")
     else:
         return original_encode(input)