def check_same_builder(old_component, new_component):
    """
    Check that the given new_component metadata describes the same builder as
    the given old_component metadata. The new_component builder does not
    necessarily need to be in the same state as when the old_component metadata
    was created to satisfy this check e.g. it may have changed devs and been
    rebalanced.

    :param old_component: a dict of metadata describing a component builder
    :param new_component: a dict of metadata describing a component builder
    :raises ValueError: if the new_component is not the same as that described
        by the old_component
    """
    for key in ['replicas', 'id']:
        if old_component[key] != new_component[key]:
            raise ValueError('Attribute mismatch for %s: %r != %r' % (key,
                old_component[key], new_component[key]))
