def extract_documents(input_dict):
    """
    Extract documents, given document indices, from Annotated Document Corpus.

    :param adc: Annotated Document Corpus
    :param index_list: list of document ids to include
    :param discard_filtered_out default-false: discard documents that are not included in index_list

    :return adc_filtered: adc with documents that fulfil the condition
    :return adc_rest: adc with documents that do not fulfil the condtion
    """
    discard_filtered_out = input_dict['discard_filtered_out'] == 'true'
    included = input_dict['index_list']
    for i in included:
        if i < 0 or i >= len(input_dict['adc'].documents) or type(i) != int:
            raise Exception('Document indices are set incorrectly.')
    discarded = [i for i in range(len(input_dict['adc'].documents)) if i not in
        input_dict['index_list']]
    adc_filtered, adc_rest = input_dict['adc'].split(included, None if
        discard_filtered_out else discarded)
    return {'adc_filtered': adc_filtered, 'adc_rest': adc_rest}
