DRY. 
Make the replacement an inner function. Something like this:

```
def clean(param_string):
     # some nice comment here about why Apache is a bitch
     return param_string.replace(...)
if isinstance(input, (tuple, list)): 
    return [clean(x) for x in input]
else:
    return clean(input)
```

The AttributeError is ideally when working with unknown objects. Not for standard types.