def Index(func):
    """Decorator to mark function as index.

    Marks instance methods of a DBObject-decorated class as being used for
    indexing. The function name is used as the index name, and the return
    value is used as the index value.

    Note that callables are call recursively so in theory you can return
    a function which will be called to get the index value.
    """
    func.is_index = True
    return func
