'Check if descriptor can be used with given domain.
Return True if descriptor\'s expression contains only
available variables and descriptors name does not clash with
existing variables.'

def is_valid_item(self, setting, descriptor, attrs, metas):

    if ((descriptor.name in attrs) or (descriptor.name in metas)):
        return False
    try:
        exp_ast = ast.parse(descriptor.expression, mode='eval')
    except Exception:
        return False
    for name in freevars(exp_ast, []):
        if (not ((name in attrs) or (name in metas))):
            return False
    return True
