def remove_extra_spaces(inputstr):
    """Remove extra spaces in *inputstr* so that there are only single spaces.

    Parameters
    ----------
    inputstr : str

    Returns
    -------
    str
    """
    while '  ' in inputstr:
        inputstr = inputstr.replace('  ', ' ')
    return inputstr.strip()
