class_docstr: Dictionary-like class that provides attribute-style access to its items.
  
  A ``Bunch`` is a simple container that stores its items as class
  attributes [1]_. Internally all items are stored in a dictionary and
  the class exposes several of the dictionary methods.
  
  Examples
  --------
  >>> from nipype.interfaces.base import Bunch
  >>> inputs = Bunch(infile='subj.nii', fwhm=6.0, register_to_mean=True)
  >>> inputs
  Bunch(fwhm=6.0, infile='subj.nii', register_to_mean=True)
  >>> inputs.register_to_mean = False
  >>> inputs
  Bunch(fwhm=6.0, infile='subj.nii', register_to_mean=False)
  
  References
  ----------
  .. [1] A. Martelli, D. Hudgeon, "Collecting a Bunch of Named
         Items", Python Cookbook, 2nd Ed, Chapter 4.18, 2005.
docstr: Return a dictionary of our items with hashes for each file.
  
  Searches through dictionary items and if an item is a file, it
  calculates the md5 hash of the file contents and stores the
  file name and hash value as the new key value.
  
  However, the overall bunch hash is calculated only on the hash
  value of a file. The path and name of the file are not used in
  the overall hash calculation.
  
  Returns
  -------
  dict_withhash : dict
      Copy of our dictionary with the new file hashes included
      with each file.
  hashvalue : str
      The md5 hash value of the `dict_withhash`
docstr_tok: ["Return","a","dictionary","of","our","items","with","hashes","for","each","file",".","Searches","through","dictionary","items","and","if","an","item","is","a","file",",","it","calculates","the","md5","hash","of","the","file","contents","and","stores","the","file","name","and","hash","value","as","the","new","key","value",".","However",",","the","overall","bunch","hash","is","calculated","only","on","the","hash","value","of","a","file",".","The","path","and","name","of","the","file","are","not","used","in","the","overall","hash","calculation",".","Returns","--","--","--","-","dict_withhash",":","dict","Copy","of","our","dictionary","with","the","new","file","hashes","included","with","each","file",".","hashvalue",":","str","The","md5","hash","value","of","the","`","dict_withhash","`"]
code: def _get_bunch_hash(self):
      """Return a dictionary of our items with hashes for each file.
  
      Searches through dictionary items and if an item is a file, it
      calculates the md5 hash of the file contents and stores the
      file name and hash value as the new key value.
  
      However, the overall bunch hash is calculated only on the hash
      value of a file. The path and name of the file are not used in
      the overall hash calculation.
  
      Returns
      -------
      dict_withhash : dict
          Copy of our dictionary with the new file hashes included
          with each file.
      hashvalue : str
          The md5 hash value of the `dict_withhash`
  
      """
  
      infile_list = []
      for key, val in list(self.items()):
          if is_container(val):
              # XXX - SG this probably doesn't catch numpy arrays
              # containing embedded file names either.
              if isinstance(val, dict):
                  # XXX - SG should traverse dicts, but ignoring for now
                  item = None
              else:
                  if len(val) == 0:
                      raise AttributeError(
                          "%s attribute is empty" % key
                      )
                  item = val[0]
          else:
              item = val
          try:
              if isinstance(item, str) and os.path.isfile(item):
                  infile_list.append(key)
          except TypeError:
              # `item` is not a file or string.
              continue
      dict_withhash = self.dictcopy()
      dict_nofilename = self.dictcopy()
      for item in infile_list:
          dict_withhash[item] = _hash_bunch_dict(dict_withhash, item)
          dict_nofilename[item] = [
              val[1] for val in dict_withhash[item]
          ]
      # Sort the items of the dictionary, before hashing the string
      # representation so we get a predictable order of the
      # dictionary.
      sorted_dict = str(sorted(dict_nofilename.items()))
      return dict_withhash, md5(sorted_dict.encode()).hexdigest()
  
imports: import os
  from contextlib import AbstractContextManager
  from copy import deepcopy
  from textwrap import wrap
  import re
  from datetime import datetime
  from dateutil.parser import parse
  import platform
  from ...None import logging, config
  from ...utils.misc import is_container, rgetcwd
  from ...utils.filemanip import md5, hash_infile
label_desc: Use image node_id 9 for calling the Bunch obj's underlying member method code with example usage: obj._get_bunch_hash() and returns: dict_withhash,  md5