     ))
 
 
+(defn seqable? [x]
+  (instance? clojure.lang.Seqable x))
+
 (defn- normalize-to-key-name-map [d]
   (cond (map? d)
         (->> d

             (map (fn [[k v]] [k (normalize-string-value-to-body-map v)]))
             (into {}))

        (instance?  clojure.lang.Seqable d)
        (->> d
             (map (fn [v] (normalize-string-value-to-body-map v))))

        :else (throw (IllegalStateException.
                       (str (type d) "  must a map or Seqable!")))))

;### Debug ####################################################################

(defn- normalize-context [context-spec]
  (-> context-spec
      (#(if (:tasks %) % (assoc % :tasks [])))
      (#(assoc % :tasks (normalize-seq-with-string-value-to-body-map (:tasks %))))
      (#(assoc % :tasks (normalize-to-key-name-map (:tasks %))))
      (#(assoc % :tasks (normalize-body-tasks-to-script-tasks (:tasks %))))
      (#(if-let[subcontexts (:subcontexts %)]
          (assoc % :subcontexts
                 (->> subcontexts

                           (assoc :key (or (:key v) k))
                           (assoc :name (or (:name v) k)))]))
             (into {}))
        (seqable? d)
        (->> d
             (map-indexed (fn [i v] [(or (:key v) (:name v) (str i)) v]))
             (into {}))
