def extract_doi(doi):
    """Ensure that 'doi' is a single string
    
    Occasionally, INSPIRE returns a list of identical DOIs.  This just extracts the
    first element if it is such a list, or returns the input otherwise.

    """
    if isinstance(doi, list) and len(doi)>0:
        return doi[0]
    return doi