def fold_list(input_list, max_width=None):
    """
    Fold the entries in input_list. If max_width is not None, fold only if it
    is longer than max_width. Otherwise fold each entry.
    """
    if not input_list:
        return ""
    if not isinstance(input_list[0], six.string_types):
        input_list = [str(item) for item in input_list]

    if max_width:
        mystr = ", ".join(input_list)
        return fold_string(mystr, max_width)

    return "\n".join(input_list)
Fold the entries in input_list. If max_width is not None, fold only if it
    is longer than max_width. Otherwise fold each entry.