def getMaxLen(dictlist):
    """
    parses a list of dict (common output from RHN API) and calculates the longest
    entry for each key it finds.
    Currently does not do recursion, so dicts of dicts are not supported.
    TODO: add this in future release.

    This is useful for formatting output

    returns:
    dict { 'key' : maxlength(int) }

    parameters:
    dictlist(list of dict)  - list of dictionary structures.
    """
    maxlen = {}
    for d in dictlist:
        for k, v in d.items():
            curval = maxlen.get(k, 0)
            try:
                mylen = len(v)
            except:
                mylen = len(str(v))
            if mylen > curval:
                maxlen[k] = mylen
    return maxlen
