def check_single_dict_differences(spec, dev, type_str, bidirectional):
    """Compare a single attribute/command

    Parameters
    ----------
    spec : dict
        A single Attribute/Command dictionary form the specficication
        E.g {'disp_level': 'OPERATOR',
             'doc_in': 'ON/OFF',
             'doc_out': 'Uninitialised',
             'dtype_in': 'DevBoolean',
             'dtype_out': 'DevVoid',
             'name': 'Capture'}

    dev : dict
        A single Attribute/Command dictionary form the device
        E.g {'disp_level': 'OPERATOR',
             'doc_in': 'ON/OFF',
             'doc_out': 'Uninitialised',
             'dtype_in': 'DevBoolean',
             'dtype_out': 'DevVoid',
             'name': 'Capture'}

    type_str : str
        Either "Command" or "Attribute"

    bidirectional: bool
        Whether to include details on the device that is not in the specification

    Returns
    -------
    issues : list
        A list of strings describing the issues, empty list for no issues
    """
    assert spec["name"] == dev["name"]
    issues = []

    if spec != dev:
        spec_keys = set(spec.keys())
        dev_keys = set(dev.keys())

        keys_not_in_spec = spec_keys.difference(dev_keys)
        keys_not_in_dev = dev_keys.difference(spec_keys)
        mutual_keys = spec_keys.intersection(dev_keys)

        if keys_not_in_spec:
            keys_not_in_spec = sorted(keys_not_in_spec)
            issues.append(
                "{} [{}] differs, specification has keys [{}] but it's "
                "not in device".format(type_str, spec["name"], ",".join(keys_not_in_spec))
            )

        if keys_not_in_dev and bidirectional:
            keys_not_in_dev = sorted(keys_not_in_dev)
            issues.append(
                "{} [{}] differs, device has keys [{}] but it's "
                "not in the specification".format(
                    type_str, spec["name"], ",".join(keys_not_in_dev)
                )
            )

        for key in mutual_keys:
            if dev[key] != spec[key]:
                issues.append("{} [{}] differs:".format(type_str, spec["name"]))
                issues.append(
                    "\t{}:\n\t\tspecification: {}\n\t\tdevice: {}".format(
                        key, spec[key], dev[key]
                    )
                )

    return issues