def createDictFromAttr(objList, attr):
    """\
Group the objects in objList based on their value for a specific attribute.

Return: A dict where each key is one of the values attested for the attribute.  The value associated with each key is a list of objects whose value for attr was the same as the key.

Parameters:
  * objList: A list of objects, each having the attribute specified in attr.
  * attr: A string indicating the attribute of interest.
"""

    dct = dict()
    for o in objList:
        key = getattr(o, attr)
        lst = dct.get(key)

        if lst:
            lst.append(o)
        else:
            dct[key] = [o]
    return dct