Recursively copy all groups/datasets/attributes from from_file[key] to
    to_file. Datasets are not overwritten, attributes are.

def copy_group(from_file, to_file, key):
    """Recursively copy all groups/datasets/attributes from from_file[key] to
    to_file. Datasets are not overwritten, attributes are.
    """
    if not key in to_file:
        from_file.copy(key, to_file, key)
    else:
        # also make sure any additional attributes are copied
        for attr in from_file[key].attrs:
            to_file.attrs[attr] = from_file[key].attrs[attr]
            
        if hasattr(from_file[key], 'keys'):
            for subkey in from_file[key].keys():
                copy_group(from_file, to_file, '/'.join([key,subkey]))