<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter(self, zone='all'):
 """Filter nodes by their attributes. :param zone: A zone containing nodes. :type zone: ``str`` :return: A chainable filter object. :rtype: ``object`` of :class:`Filter` """

        if not self.is_connected():
            return None

        nodes = self.gce.list_nodes(zone)
        return Filter(nodes)