def _set_index(x, index):
    """ set the index attribute of something it is possible
    
    if index is None, or x doesn't have an index attribute it won't do anything
    
    """
    if index is None:
        return x
    if hasattr(x, 'index'):
        x.index = index
    return x
