Iterate over lines skipping whitespace and comments.
Each line has its whitespace stripped and then it is checked whether it .startswith(comments) . This means comments can be a string or a list of strings.