<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add(self, resource, replace=False):
 """Add a single resource, check for dupes."""

        uri = resource.uri
        for r in self:
            if (uri == r.uri):
                if (replace):
                    r = resource
                    return
                else:
                    raise ResourceListDupeError(
                        "Attempt to add resource already in resource_list")
        # didn't find it in list, add to end
        self.append(resource)