def _pretty_frame(frame):

    """
    Helper function for pretty-printing a frame.

    :param frame: The frame to be printed.
    :type frame: AttrDict
    :return: A nicely formated string representation of the frame.
    :rtype: str
    """

    outstr = ""
    outstr += "frame ({0.ID}): {0.name}\n\n".format(frame)
    outstr += "[definition]\n"
    outstr += _pretty_longstring(frame.definition, '  ') + '\n'

    outstr += "[semTypes] {0} semantic types\n".format(len(frame.semTypes))
    outstr += "  "*(len(frame.semTypes)>0) + ", ".join("{0}({1})".format(x.name, x.ID) for x in frame.semTypes) + '\n'*(len(frame.semTypes)>0)

    outstr += "\n[frameRelations] {0} frame relations\n".format(len(frame.frameRelations))
    outstr += '  ' + '\n  '.join(repr(frel) for frel in frame.frameRelations) + '\n'

    outstr += "\n[lexUnit] {0} lexical units\n".format(len(frame.lexUnit))
    lustrs = []
    for luName,lu in sorted(frame.lexUnit.items()):
        tmpstr = '{0} ({1})'.format(luName, lu.ID)
        lustrs.append(tmpstr)
    outstr += "{0}\n".format(_pretty_longstring(', '.join(lustrs),prefix='  '))

    outstr += "\n[FE] {0} frame elements\n".format(len(frame.FE))
    fes = {}
    for feName,fe in sorted(frame.FE.items()):
        try:
            fes[fe.coreType].append("{0} ({1})".format(feName, fe.ID))
        except __HOLE__:
            fes[fe.coreType] = []
            fes[fe.coreType].append("{0} ({1})".format(feName, fe.ID))
    for ct in sorted(fes.keys(), key=lambda ct2: ['Core','Core-Unexpressed','Peripheral','Extra-Thematic'].index(ct2)):
        outstr += "{0:>16}: {1}\n".format(ct, ', '.join(sorted(fes[ct])))

    outstr += "\n[FEcoreSets] {0} frame element core sets\n".format(len(frame.FEcoreSets))
    outstr += "  " + '\n  '.join(", ".join([x.name for x in coreSet]) for coreSet in frame.FEcoreSets) + '\n'

    return outstr
dataset/ETHPy150Open nltk/nltk/nltk/corpus/reader/framenet.py/_pretty_frame