def _remove_comments_and_spaces_from_src_line(line: str) -> str:
    """
        >>> _remove_comments_and_spaces_from_src_line('a = 42  # this is a comment')
        'a=42'
        >>> _remove_comments_and_spaces_from_src_line('m = MyClass[Parent](a=Child1())')
        'm=MyClass[Parent](a=Child1())'
    """
    return line.split('#')[0].replace(' ', '')