def _get_paths_to_intrinsics(self, input, path=None):
        """
        Returns all paths to dynamic values within a dictionary

        :param input: Input dictionary to find paths to dynamic values in
        :param path: Optional list to keep track of the path to the input dictionary
        :returns list: List of keys that defines the path to a dynamic value within the input dictionary
        """
        if path is None:
            path = []
        dynamic_value_paths = []
        if isinstance(input, dict):
            iterator = input.items()
        elif isinstance(input, list):
            iterator = enumerate(input)
        else:
            return dynamic_value_paths

        for key, value in sorted(iterator, key=lambda item: item[0]):
            if is_intrinsic(value) or is_dynamic_reference(value):
                dynamic_value_paths.append(path + [key])
            elif isinstance(value, (dict, list)):
                dynamic_value_paths.extend(self._get_paths_to_intrinsics(value, path + [key]))

        return dynamic_value_paths
 def test_is_intrinsic_on_invalid_input(self, invalid_dynamic_reference):
     self.assertFalse(is_dynamic_reference(invalid_dynamic_reference))
 def test_is_dynamic_reference_must_detect_dynamic_reference(
         self, dynamic_reference):
     self.assertTrue(is_dynamic_reference(dynamic_reference))