'Find a storage policy by its index.
An index of None will be treated as 0.
:param index: numeric index of the storage policy
:returns: storage policy, or None if no such policy'

def get_by_index(self, index):

    if (index in ('', None)):
        index = 0
    else:
        try:
            index = int(index)
        except ValueError:
            return None
    return self.by_index.get(index)
