def METHOD_NAME(cl) :
    """Function decorator to ensure input is parsed into a database object."""
    def getdb_inner(f) :
        def wrapped(*args, **kwargs) :
            if not isinstance(args[0], Base) :
                args = list(args)
                if isinstance(args[0], int) :
                    item = get_default_session().query(cl).filter_by(id=args[0]).first()
                else :
                    item = get_item(args[0])
                if not isinstance(item, cl) :
                    if isinstance(item, Simulation) and cl is Halo:
                        print("Picking first timestep and first halo")
                        item = item.timesteps[0].halos[0]
                    else :
                        raise RuntimeError("Path points to wrong type of db object %r"%item)
                args[0] = item
            return f(*args,**kwargs)
        return wrapped
    return getdb_inner