import re


def _convert_number_string(number_string):
    """
    Function to convert mixed number character strings to a number.

    Mapping: ``{'K': 1000, 'M': 1000000}``

    Parameters
    ----------
    number_string : str
        Number string to be mapped

    Returns
    -------
    number : int or float
        Converted number, tries to return a integer if possible.

    Examples
    --------
    >>> _convert_number_string('64K')
    64000 # 64 * 1000
    >>> _convert_number_string('0.2M')
    200000 # 0.2 * 1000000
    """
    map_number = {'K': 1000, 'M': 1000000}
    pure_number = re.sub('[A-Z]', '', number_string)
    rv = int(pure_number) if pure_number.isdigit() else float(pure_number)
    for i in number_string:
        if i.isalpha():
            rv *= map_number[i]
    return rv