python error line 6, in class Noddy: : I have an task to do to figure out what the code below does. it looks like it was constructed in python2 but I want to use python3. I have installed argparse which it requires and set up necessary file path but every time I run the program in command Line I get these issues.

line 6, in <module>
    class Noddy:

line 63, in Noddy
    if __name__ == '__main__': main()

 line 57, in main
    ent = Noddy.make(fools)

The code is below.

    #! python3
# Hello World program in Python
# Hello World program in Python

class Noddy:
    def __init__(self, x):
        self.ant = None
        self.dec = None
        self.holder = x

    @classmethod
    def make(self, l):
        ent = Noddy(l.pop(0))
        for x in l:
            ent.scrobble(x)
        return ent

    def scrobble(self, x):
        if self.holder > x:
            if self.ant is None:
                self.ant = Noddy(x)
            else:
                self.ant.scrobble(x)
        else:
            if self.dec is None:
                self.dec = Noddy(x)
            else:
                self.dec.scrobble(x)

    def bubble(self):
        if self.ant:
            for x in self.ant.bubble():
                yield x
            yield self.holder
            if self.dec:
                for x in self.dec.bubble():
                    yield x

    def bobble(self):
        yield self.holder
        if self.ant:
            for x in self.ant.bobble():
                yield x
        if self.dec:
            for x in self.dec.bobble():
                yield x

    def main():
        import argparse
        ap = argparse.ArgumentParser()
        ap.add_argument("foo")
        args = ap.parse_args()

        foo = open(args.foo)
        fools = [int(bar) for bar in foo]
        ent = Noddy.make(fools)

        print(list(ent.bubble()))
        print
        print(list(ent.bobble()))

    if __name__ == '__main__': main()
