def _displayattrs(attrib, expandattrs):
    """
    Helper function to display the attributes of a Node object in lexicographic
    order.

    :param attrib: dictionary with the attributes
    :param expandattrs: if True also displays the value of the attributes
    """
    if not attrib:
        return ''
    if expandattrs:
        alist = ['%s=%r' % item for item in sorted(attrib.items())]
    else:
        alist = list(attrib)
    return '{%s}' % ', '.join(alist)
def _displayattrs ( attrib , expandattrs ) : if not attrib : return '' if expandattrs : alist = [ '%s=%r' % item for item in sorted ( attrib . items ( ) ) ] else : alist = list ( attrib ) return '{%s}' % ', ' . join ( alist )
Helper function to display the attributes of a Node object in lexicographic
    order.

    :param attrib: dictionary with the attributes
    :param expandattrs: if True also displays the value of the attributes