code: def _parse_script_sig(TxIn, script_sig):
          '''
          byte_string -> (byte_string, byte_string)
          '''
          # Is there a better way to do this?
          stack_script = script_sig
          redeem_script = b''
          try:
              # If the last entry deserializes, it's a p2sh input
              # There is a vanishingly small edge case where the pubkey
              #   forms a deserializable script.
              # Edge case: serialization errors on CODESEPARATOR
              deserialized = serialization.deserialize(script_sig)
              items = deserialized.split()
              serialization.hex_deserialize(items[-1])
              stack_script = serialization.serialize(' '.join(items[:-1]))
              redeem_script = serialization.serialize(items[-1])
          except (IndexError, ValueError, NotImplementedError):
              pass
  
          return stack_script, redeem_scripf _parse_script_sig(TxIn, script_sig):
          '''
          byte_string -> (byte_string, byte_string)
          '''
          # Is there a better way to do this?
          stack_script = script_sig
          redeem_script = b''
          try:
              # If the last entry deserializes, it's a p2sh input
              # There is a vanishingly small edge case where the pubkey
              #   forms a deserializable script.
              # Edge case: serialization errors on CODESEPARATOR
              deserialized = serialization.deserialize(script_sig)
              items = deserialized.split()
              serialization.hex_deserialize(items[-1])
              stack_script = serialization.serialize(' '.join(items[:-1]))
              redeem_script = serialization.serialize(items[-1])
          except (IndexError, ValueError, NotImplementedError):
              pass
  
          return stack_script, redeem_script
docs: byte_string -> (byte_string, byte_string)