def _get_or_create_identifiers(node):
 (doi, metadata) = _build_ezid_metadata(node)
 client = EzidClient(settings.EZID_USERNAME, settings.EZID_PASSWORD)
 try:
  resp = client.create_identifier(doi, metadata)
  return dict(([each.strip('/') for each in pair.strip().split(':')] for pair in resp['success'].split('|')))
 except HTTPError as error:
  if ('identifier already exists' not in error.message.lower()):
   raise
  resp = client.get_identifier(doi)
  doi = resp['success']
  suffix = doi.strip(settings.DOI_NAMESPACE)
  return {'doi': doi.replace('doi:', ''), 'ark': '{0}{1}'.format(settings.ARK_NAMESPACE.replace('ark:', ''), suffix)}

def _get_or_create_identifiers ( node ) : ( doi , metadata ) = _build_ezid_metadata ( node ) client = EzidClient ( settings . EZID_USERNAME , settings . EZID_PASSWORD ) try : resp = client . create_identifier ( doi , metadata ) return dict ( ( [ each . strip ( '/' ) for each in pair . strip ( ) . split ( ':' ) ] for pair in resp [ 'success' ] . split ( '|' ) ) ) except HTTPError as error : if ( 'identifier already exists' not in error . message . lower ( ) ) : raise resp = client . get_identifier ( doi ) doi = resp [ 'success' ] suffix = doi . strip ( settings . DOI_NAMESPACE ) return { 'doi' : doi . replace ( 'doi:' , '' ) , 'ark' : '{0}{1}' . format ( settings . ARK_NAMESPACE . replace ( 'ark:' , '' ) , suffix ) }
note: arks include a leading slash .