<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_params(filename, asheader=False, verbosity=0) -> Dict[str, Union[int, float, bool, str, None]]: """Read parameter dictionary from text file. Assumes that parameters are specified in the format: par1 = value1 par2 = value2 Comments that start with '#' are allowed. Parameters filename : str, Path Filename of data file. asheader : bool, optional Read the dictionary from the header (comment section) of a file. Returns ------- Dictionary that stores parameters. """

    filename = str(filename)  # allow passing pathlib.Path objects
    from collections import OrderedDict
    params = OrderedDict([])
    for line in open(filename):
        if '=' in line:
            if not asheader or line.startswith('#'):
                line = line[1:] if line.startswith('#') else line
                key, val = line.split('=')
                key = key.strip()
                val = val.strip()
                params[key] = convert_string(val)
    return params