def _render_order(order):
    """Render the order by part of a query.

    Parameters
    ----------
    order : dict
        A dictionary with two keys, fields and direction.
        Such that the dictionary should be formatted as
        {'fields': ['TimeStamp'], 'direction':'desc'}.

    Returns
    -------
    str
        A string that represents the "order by" part of a query.
    """
    if not order or 'fields' not in order or 'direction' not in order:
        return ''
    return 'ORDER BY %s %s' % (', '.join(order['fields']), order['direction'])
