'Sort variables, but disallow sorting of non-symbols.
When taking derivatives, the following rules usually hold:
* Derivative wrt different symbols commute.
* Derivative wrt different non-symbols commute.
* Derivatives wrt symbols and non-symbols don\'t commute.
Examples
>>> from sympy import Derivative, Function, symbols
>>> vsort = Derivative._sort_variables
>>> x, y, z = symbols(\'x y z\')
>>> f, g, h = symbols(\'f g h\', cls=Function)
>>> vsort((x,y,z))
[x, y, z]
>>> vsort((h(x),g(x),f(x)))
[f(x), g(x), h(x)]
>>> vsort((z,y,x,h(x),g(x),f(x)))
[x, y, z, f(x), g(x), h(x)]
>>> vsort((x,f(x),y,f(y)))
[x, f(x), y, f(y)]
>>> vsort((y,x,g(x),f(x),z,h(x),y,x))
[x, y, f(x), g(x), z, h(x), x, y]
>>> vsort((z,y,f(x),x,f(x),g(x)))
[y, z, f(x), x, f(x), g(x)]
>>> vsort((z,y,f(x),x,f(x),g(x),z,z,y,x))
[y, z, f(x), x, f(x), g(x), x, y, z, z]'

@classmethod
def _sort_variables(cls, vars):

    sorted_vars = []
    symbol_part = []
    non_symbol_part = []
    for v in vars:
        if (not v.is_symbol):
            if (len(symbol_part) > 0):
                sorted_vars.extend(sorted(symbol_part, key=default_sort_key))
                symbol_part = []
            non_symbol_part.append(v)
        else:
            if (len(non_symbol_part) > 0):
                sorted_vars.extend(sorted(non_symbol_part, key=default_sort_key))
                non_symbol_part = []
            symbol_part.append(v)
    if (len(non_symbol_part) > 0):
        sorted_vars.extend(sorted(non_symbol_part, key=default_sort_key))
    if (len(symbol_part) > 0):
        sorted_vars.extend(sorted(symbol_part, key=default_sort_key))
    return sorted_vars
