import pickle


def obtain_metadata(input_dir, split):
    """
    Get the metadata provided input directory and split of data.
    Args:
                input_dir (str)   The path to the directory that has all the input files, including 'metadata.pkl'
                split (str)       Should be one of the 9 split tags, i.e. 'train', 'val_id', 'test_id',
                                  'val_ood_cat/ads/both', and 'test_ood_cat/ads/both'.

    Returns:
                metadata (tuple)  adslab properties.
                                  Ex: ('mp-126', (1,1,1), 0.025, True, '*OH', (0,0,0), 'val_ood_ads')
    """
    m = pickle.load(open(input_dir+'metadata.pkl', 'rb'))
    m = m['adsorbed_bulk_metadata']
    metadata = (*m, split)
    return metadata