Convert dict into object of class of passed model.

        :param class model_cls:
        :param object data:
        :rtype DomainModel:

def _get_model_instance(model_cls, data):
        """Convert dict into object of class of passed model.

        :param class model_cls:
        :param object data:
        :rtype DomainModel:
        """
        if not isinstance(data, (model_cls, dict)):
            raise TypeError('{0} is not valid type, instance of '
                            '{1} or dict required'.format(data, model_cls))
        return model_cls(**data) if isinstance(data, dict) else data