@staticmethod
def _strip_comments(line, comments=None):
    """Removes comments from import line."""
    if comments is None:
        comments = []
    new_comments = False
    comment_start = line.find('#')
    if comment_start != -1:
        comments.append(line[comment_start + 1:].strip())
        new_comments = True
        line = line[:comment_start]
    return line, comments, new_comments
