import re


def create_rules(fileObj):
    """Creates a dictionary of key - values pairs. Used by replaceChars
    function

    Args:
        fileObj: A file object with lines in the following format (no spaces)
            old_char=new_char 
        
    Returns:
        A python dictionary with key - value pairs 
    """
    rules={}
    with open (fileObj, "r") as rules_file:
        for line in rules_file:
            rules_list = line.split('=')
            rules[rules_list[0]] = re.sub(r'\n$', '', rules_list[1])
    #print(rules)
    return rules