'Flatten nested dicts by combining keys with a separator.  Lists with
only string items are included as is; any other lists are discarded.'

def _flatten_dict(self, d, parent_key='', sep='_'):

    items = []
    for (k, v) in d.items():
        if k.startswith('_'):
            continue
        new_key = (((parent_key + sep) + k) if parent_key else k)
        if isinstance(v, collections.MutableMapping):
            items.extend(self._flatten_dict(v, new_key, sep).items())
        elif isinstance(v, (list, tuple)):
            if all([isinstance(x, string_types) for x in v]):
                items.append((new_key, v))
        else:
            items.append((new_key, v))
    return dict(items)
