pub fn py_to_contract(obj: &Bound<'_, PyAny>) -> PyResult<Contract>
Convert a Python object (IBContract or dict) to a Rust Contract.
Returns a PyValueError if conversion fails.