'Creates and returns a query Document2 object
:param owner: owner of doc
:param query_type: hive, impala or spark
:param database: database name
:param name: name of document
:param description: description of document
:param statement: SQL statement (can be multi-query statement)
:param files: list of dicts representing files
:param functions: list of dicts representing functions
:param settings: list of dicts representing settings
:return: Document2 object representing query'

def create_query_document(self, owner, query_type='hive', database='default', name='Test    Query', description='Test    Query', statement='', files=None, functions=None, settings=None):

    if (query_type not in ('hive', 'impala', 'spark')):
        raise ValueError(('Invalid    query_type:    %s' % query_type))
    notebook = make_notebook(name=name, description=description, editor_type=query_type, statement=statement, status='ready', database=database, files=files, functions=functions, settings=settings)
    (notebook_doc, save_as) = _save_notebook(notebook.get_data(), owner)
    return notebook_doc
