:param py: python format or not

def format_item(item, py=True):
    """
    :param py: python format or not
    """
    # for non python format, just output itself.
    # so the result is `something` instead of `"something"`
    if not py:
        return unicode(item)

    if isinstance(item, (str, unicode)):
        # long int is prefixed by a #
        if item.startswith('#'):
            return unicode(long(item[1:]))
        return u'"{0}"'.format(item)

    return unicode(item)