code: def load_hook_files(pathname):
      global hooks
      if sys.version_info[0] > 2 and sys.version_info[1] > 4:
          fsglob = sorted(glob.iglob(pathname, recursive=True))
      else:
          fsglob = sorted(glob.iglob(pathname))
      for path in fsglob:
          real_path = os.path.realpath(path)
          if os.path.dirname(real_path) not in sys.path:
              sys.path.append(os.path.dirname(real_path))
          module = imp.load_source(os.path.basename(path), real_path)
          for name in dir(module):
              obj = getattr(module, name)
              if hasattr(obj, 'dredd_hooks') and callable(obj):
                  func_hooks = getattr(obj, 'dredd_hooks')
                  for hook, name in func_hooks:
                      if hook == BEFORE_ALL:
                          hooks._before_all.append(obj)
                      if hook == AFTER_ALL:
                          hooks._after_all.append(obj)
                      if hook == BEFORE_EACH:
                          hooks._before_each.append(obj)
                      if hook == AFTER_EACH:
                          hooks._after_each.append(obj)
                      if hook == BEFORE_EACH_VALIDATION:
                          hooks._before_each_validation.append(obj)
                      if hook == BEFORE_VALIDATION:
                          add_named_hook(hooks._before_validation, obj, name)
                      if hook == BEFORE:
                          add_named_hook(hooks._before, obj, name)
                      if hook == AFTER:
                          add_named_hook(hooks._after, obj, name)