docs: def get_nodes(environment=None):
      """Gets all nodes found in the nodes/ directory"""
      if not os.path.exists('nodes'):
          return []
      nodes = []
      for filename in sorted(
              [f for f in os.listdir('nodes')
               if (not os.path.isdir(f)
                   and f.endswith(".json") and not f.startswith('.'))]):
          fqdn = ".".join(filename.split('.')[:-1])  # Remove .json from name
          node = get_node(fqdn)
          if environment is None or node.get('chef_environment') == environment:
              nodes.append(node)
      return nodes