def flag_match(obj, flags):
    """
    Given a component or attribute, return true if it matches all of the given flags
    and False otherwise. If there are no flags, always return True.
    """
    if "flags" in obj:
        return all(obj['flags'][key] == value for key, value in flags.items())
    return True