def retry_if_value_error(exception): """Return True if we should retry (in this case when it's an IOError), False otherwise""" return isinstance(exception, ValueError)