<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def split_adhoc_filters_into_base_filters(fd):
 """ Mutates form data to restructure the adhoc filters in the form of the four base filters, `where`, `having`, `filters`, and `having_filters` which represent free form where sql, free form having sql, structured where clauses and structured having clauses. """

    adhoc_filters = fd.get('adhoc_filters')
    if isinstance(adhoc_filters, list):
        simple_where_filters = []
        simple_having_filters = []
        sql_where_filters = []
        sql_having_filters = []
        for adhoc_filter in adhoc_filters:
            expression_type = adhoc_filter.get('expressionType')
            clause = adhoc_filter.get('clause')
            if expression_type == 'SIMPLE':
                if clause == 'WHERE':
                    simple_where_filters.append({
                        'col': adhoc_filter.get('subject'),
                        'op': adhoc_filter.get('operator'),
                        'val': adhoc_filter.get('comparator'),
                    })
                elif clause == 'HAVING':
                    simple_having_filters.append({
                        'col': adhoc_filter.get('subject'),
                        'op': adhoc_filter.get('operator'),
                        'val': adhoc_filter.get('comparator'),
                    })
            elif expression_type == 'SQL':
                if clause == 'WHERE':
                    sql_where_filters.append(adhoc_filter.get('sqlExpression'))
                elif clause == 'HAVING':
                    sql_having_filters.append(adhoc_filter.get('sqlExpression'))
        fd['where'] = ' AND '.join(['({})'.format(sql) for sql in sql_where_filters])
        fd['having'] = ' AND '.join(['({})'.format(sql) for sql in sql_having_filters])
        fd['having_filters'] = simple_having_filters
        fd['filters'] = simple_where_filters