def get_region_for_sample(sample, bpid, target):
    """
    Parse a dictionary and obtain the region for a given sample
    """
    for sample_id in target:
        if sample.find(sample_id) != -1:
            if bpid == 1:
                return target[sample_id]['region1']
            else:
                return target[sample_id]['region2']
            break