def get_possible_bibrefs_from_pid_bibrec(pid, bibreclist, always_match=False):
    '''
    Returns for each bibrec a list of bibrefs for which the surname matches.
    @param pid: person id to gather the names strings from
    @param bibreclist: list of bibrecs on which to search
    '''
    pid = wash_integer_id(pid)

    pid_names = tu.get_person_names_set([pid])
    lists = []
    for bibrec in bibreclist:
        lists.append([bibrec, tu.get_possible_bibrecref([n[0] for n in pid_names], bibrec,
                                                        always_match)])
    return lists
def get_bibrefs_from_bibrecs(bibreclist):
    '''
    Retrieve all bibrefs for all the recids in the list

    @param bibreclist: list of record IDs
    @type bibreclist: list of int

    @return: a list of record->bibrefs
    @return: list of lists
    '''
    lists = []
    for bibrec in bibreclist:
        lists.append([bibrec, tu.get_possible_bibrecref([''], bibrec,
                                                        always_match=True)])
    return lists