<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def import_dictionary(dictionary):
 """ Function used to import the dictionary file into memory opened_file should be an already opened dictionary file :raises DictionaryNotFoundError if dictionary can't be loaded """

    def load_into_dictionary(dictionary_file):
        """create the dictionary to hold the words"""
        to_return = dict()
        for line in dictionary_file:
            try:
                to_return[line[0].lower()].append(line.strip().lower())
            except KeyError:
                to_return[line[0].lower()] = [line.strip().lower()]

        return to_return

    try:
        with open(dictionary) as dictionary_file:
            to_return = load_into_dictionary(dictionary_file)

    except TypeError:
        to_return = load_into_dictionary(dictionary)

    except IOError:
        message = "Could not find the dictionary at {}".format(dictionary)
        raise DictionaryNotFoundError(message)

    return to_return