import re


def obj_check_attr(obj, attr, dict):
    """
    Return True/False if attr (namespace/scene) is to be included in import/export
    obj: Namespace or Scene object
    attr: Which attribute to check ('namespace' or 'scene')
    dict: Dictionary of namespace or scene from config
    """
    if obj[attr] in dict:
        return True
    if not 'regex' in dict: return False
    if not obj[attr]: return False
    regex = dict['regex'].get('value', '')
    skip = dict['regex'].get('skip', False)
    match = bool(re.search(regex, obj[attr]))
    return match and not skip