def entity_tostring(entity):
    """Converts one GNL (Google Natural Language) entity to a readable string."""

    metadata = ", ".join(['"%s": "%s"' % (key, value) for
                          key, value in entity.metadata.items()])

    mentions = ", ".join(['"%s"' % mention for mention in entity.mentions])

    return ('{name: "%s",'
            ' type: "%s",'
            ' metadata: {%s},'
            ' salience: %s,'
            ' mentions: [%s]}') % (
               entity.name,
               entity.type,
               metadata,
               entity.salience,
               mentions)