def compare_metadata(expected, sample):
    """Compares the keys and values of ``expected`` with the keys and values of ``sample``

    :param dict expected: The dictionary containing the expected metadata.
    :param dict sample: The dictionary of metadata which must be a complete superset of the expected metadata.
    :return: Whether ``expected`` is a complete and equal subset of ``sample``.
    :rtype: bool
    """
    for k, v in expected.items():
        if k not in sample or v != sample[k]:
            return False

    return True