def count_frequencies(file) -> dict:

    """
    This function opens a text file as an argument and then returns the
    frequencies each character occurs in the text file. The characters
    are then sorted out by order starting from the lowest frequency to
    the highest. Values sorted by ascending order.
    """

    dictionary = {}
    # loops through every line in the text file in config.json
    for line in file:
        # loops through every character in the text file in config.json
        for char in line:
            # checks if character has already been added to the dictionary
            if char not in dictionary:
                dictionary[char] = 1
            else:
                # if not added, then it proceeds to add that character into dictionary
                dictionary[char] = dictionary[char] + 1
    # dictionary is returned
    return dictionary