Returns an object returned from a factory method

def _handle_factory_method(self, service_obj, method_name,
                               args=None, kwargs=None):
        """" Returns an object returned from a factory method """
        if args is None:
            args = []
        if kwargs is None:
            kwargs = {}

        _check_type('args', args, list)
        _check_type('kwargs', kwargs, dict)

        # Replace args
        new_args = self._replace_scalars_in_args(args)
        new_kwargs = self._replace_scalars_in_kwargs(kwargs)

        return getattr(service_obj, method_name)(*new_args, **new_kwargs)