<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_valid_locations(self, locations=None):
 """Fail if 'locations' contains bad destinations. """

        if locations is None:
            locations = self.locations
        for location in locations:
            if (not self.is_server(location) and
                not self.is_ssh_url(location) and
                not self.has_host(location)):
                err_exit('Unknown location: %(location)s' % locals())