@staticmethod
def index_by(array, key):
    result = {}
    if (type(array) is dict):
        array = Exchange.keysort(array).values()
    for element in array:
        if ((key in element) and (element[key] is not None)):
            k = element[key]
            result[k] = element
    return result
@staticmethod
def index_by(array, key):
    result = {}
    if (type(array) is dict):
        array = Exchange.keysort(array).values()
    for element in array:
        if ((key in element) and (element[key] is not None)):
            k = element[key]
            result[k] = element
    return result