class SwitchManager(object):
    def extract_all_nodes(self, content):
        return [e['node'] for e in content['nodeProperties']]

    def extract_all_properties(self, content):
        pass

class SwitchManager(object):
    def extract_all_nodes(self, content):
        """
        Return all nodes.
        """
        if isinstance(content,dict) or not content.has_key('nodeProperties'):
            return None
        else:
            return [e.get('node') for e in content['nodeProperties']]

    def extract_all_properties(self, content):
        pass

Add input check when getting all nodes.
Add input check when getting all nodes.

  class SwitchManager(object):
      def extract_all_nodes(self, content):
+         """
+         Return all nodes.
+         """
+         if isinstance(content,dict) or not content.has_key('nodeProperties'):
+             return None
+         else:
-         return [e['node'] for e in content['nodeProperties']]
+             return [e.get('node') for e in content['nodeProperties']]
  
      def extract_all_properties(self, content):
          pass
  
Add input check when getting all nodes.
## Code Before:
class SwitchManager(object):
    def extract_all_nodes(self, content):
        return [e['node'] for e in content['nodeProperties']]

    def extract_all_properties(self, content):
        pass

## Instruction:
Add input check when getting all nodes.
## Code After:
class SwitchManager(object):
    def extract_all_nodes(self, content):
        """
        Return all nodes.
        """
        if isinstance(content,dict) or not content.has_key('nodeProperties'):
            return None
        else:
            return [e.get('node') for e in content['nodeProperties']]

    def extract_all_properties(self, content):
        pass
