def convert_to_filename(filename,
                        remove_file_extension=True):
    """

        Attempts to make the filename string valid.

    Args:
        filename: string
           String of a potential filename.

        remove_file_extension: bool
            Removes everything after the first found value of "." found in the
            string if set to true.

    Returns:
        A string that is valid for saving.
    """
    if remove_file_extension:
        filename = filename.split(".")[0]
    return "".join(x for x in str(
        filename) if (x.isalnum() or x.isascii()) and x != ":")