code: def dict_merged(d, _filter=None, **kw):
      
      def f(s):
          if _filter:
              return _filter(s)
          return s is not None
      d = d or {}
      for k, v in iteritems(kw):
          if f(v):
              d[k] = v
      return d
docs: Update dictionary d with the items passed as kw if the value passes _filter.