<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def mongoimport(json, database,
                ip='localhost', port=27017,
                user=None, password=None,
                delim='_', delim1=None, delim2=None,
                delim_occurance=1, delim1_occurance=1, delim2_occurance=1):
    '''
    Performs mongoimport on one or more json files.

    Args:

        json: Can be one of several things:

            - path to a single JSON file
            - an iterable (list or tuple) of one or more JSON file paths
            - path to a directory containing one or more JSON files

        database (str): Name of the database into which the JSON files
            will be imported

        ip (str): IP address of the MongoDB server. Default is ``localhost``.

        port (int): Port of the MongoDB database. Default is ``27017``.

        user (str): Username for the MongoDB database, if authentication is enabled.
            Default is ``None``, which results in attempting connection without
            authentication.

        password (str): Password for the MongoDB database, if authentication is enabled.
            Default is ``None``, which results in attempting connection without
            authentication.

        delim (str): Delimiter, when generating collection names using a single delimiter.
            Default is ``_``

        delim_occurance (int): Occurance at which to split filename when using a
            single delimiter. Default is ``1``

        delim1 (str): Left delimiter when splitting with two delimiters. Default is None.

        delim1_occurance (int): Occurance of ``delim1`` at which to split filename.
            Default is ``1``

        delim2 (str): Right delimiter when splitting with two delimiters. Default is None.

        delim2_occurance (int): Occurance of ``delim2`` at which to split filename.
            Default is ``1``
    '''
    logger = log.get_logger('mongodb')
    _print_mongoimport_info(logger)
    if type(json) in (list, tuple):
        pass
    elif os.path.isdir(json):
        from abtools.utils.pipeline import list_files
        json = list_files(json)
    else:
        json = [json, ]
    jsons = sorted([os.path.expanduser(j) for j in json if j.endswith('.json')])
    collections = _get_import_collections(jsons, delim, delim_occurance,
                                          delim1, delim1_occurance,
                                          delim2, delim2_occurance)
    logger.info('Found {} files to import'.format(len(jsons)))
    logger.info('')
    for i, (json_file, collection) in enumerate(zip(jsons, collections)):
        logger.info('[ {} ] {} --> {}'.format(i + 1, os.path.basename(json_file), collection))
        # logger.info("Performing mongoimport on {}.".format(os.path.basename(json_file)))
        # logger.info("Importing the file into collection {}.".format(collection))
        if all([user, password]):
            host = '--host {} --port {} -username {} -password {}'.format(ip, port, user, password)
        else:
            host = '--host {} --port {}'.format(ip, port)
        mongo_cmd = "mongoimport {} --db {} --collection {} --file {}".format(
            host, database, collection, json_file)
        mongo = sp.Popen(mongo_cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
        stdout, stderr = mongo.communicate()