def get_instance(model, instance_id):
    """Get an instance by id.

    :param model: a string, model name in rio.models
    :param id: an integer, instance id.
    :return: None or a SQLAlchemy Model instance.
    """
    try:
        model = get_model(model)
    except ImportError:
        return None

    return model.query.get(instance_id)