def dicom_dictify(ds):
    """Turn a pydicom Dataset into a dict with keys derived from the Element tags.

    source: https://github.com/pydicom/pydicom/issues/319

    Parameters
    ----------
    ds : pydicom.dataset.Dataset
        The Dataset to dictify

    Returns
    -------
    output : dict
    """
    output = dict()
    for elem in ds:
        if type(elem.value) == bytes:
            continue
        if elem.VR != 'SQ':
            output[f'{str(elem.tag)} {elem.name}'] = elem.value
        else:
            output[f'{str(elem.tag)} {elem.name}'] = [dicom_dictify(item)
                                                      for item in elem]
    return output