<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compare(self, src):
 """Compare this ResourceList object with that specified as src. The parameter src must also be a ResourceList object, it is assumed to be the source, and the current object is the destination. This written to work for any objects in self and sc, provided that the == operator can be used to compare them. The functioning of this method depends on the iterators for self and src providing access to the resource objects in URI order. """

        dst_iter = iter(self.resources)
        src_iter = iter(src.resources)
        same = ResourceList()
        updated = ResourceList()
        deleted = ResourceList()
        created = ResourceList()
        dst_cur = next(dst_iter, None)
        src_cur = next(src_iter, None)
        while ((dst_cur is not None) and (src_cur is not None)):
            # print 'dst='+dst_cur+'  src='+src_cur
            if (dst_cur.uri == src_cur.uri):
                if (dst_cur == src_cur):
                    same.add(dst_cur)
                else:
                    updated.add(src_cur)
                dst_cur = next(dst_iter, None)
                src_cur = next(src_iter, None)
            elif (not src_cur or dst_cur.uri < src_cur.uri):
                deleted.add(dst_cur)
                dst_cur = next(dst_iter, None)
            elif (not dst_cur or dst_cur.uri > src_cur.uri):
                created.add(src_cur)
                src_cur = next(src_iter, None)
            else:
                raise Exception("this should not be possible")
        # what do we have leftover in src or dst lists?
        while (dst_cur is not None):
            deleted.add(dst_cur)
            dst_cur = next(dst_iter, None)
        while (src_cur is not None):
            created.add(src_cur)
            src_cur = next(src_iter, None)
        # have now gone through both lists
        return(same, updated, deleted, created)