def mock_factory(r):
 mocked = mock_obj_to_dict(r)
 mocked.configure_mock(**r)
 return mocked

def mock_factory ( r ) : mocked = mock_obj_to_dict ( r ) mocked . configure_mock ( ** r ) return mocked
mocks all the attributes as well as the to_dict .