def build_group_clause(group_by):
  """Build group_by clause for a query."""

  if not group_by:
    return ''

  if type(group_by) not in (tuple, list):
    group_by = (group_by,)

  return 'GROUP BY %s' % ', '.join(group_by)