'Sorts nodes in-place (and returns the sorted list) according to
the configured strategy. The default "sorting" is to randomly
shuffle the nodes. If the "timing" strategy is chosen, the nodes
are sorted according to the stored timing data.
:param nodes: a list of nodes
:param policy: an instance of :class:`BaseStoragePolicy`'

def sort_nodes(self, nodes, policy=None):

    shuffle(nodes)
    policy_options = self.get_policy_options(policy)
    if (policy_options.sorting_method == 'timing'):
        now = time()
        def key_func(node):
            (timing, expires) = self.node_timings.get(node['ip'], ((-1.0), 0))
            return (timing if (expires > now) else (-1.0))
        nodes.sort(key=key_func)
    elif (policy_options.sorting_method == 'affinity'):
        nodes.sort(key=policy_options.read_affinity_sort_key)
    return nodes
