def _delete_asset(course_key, asset_key_string):
 if asset_key_string:
  try:
   asset_key = AssetKey.from_string(asset_key_string)
  except InvalidKeyError:
   if ('/' == asset_key_string[0]):
    asset_key_string = asset_key_string[1:]
    try:
     asset_key = AssetKey.from_string(asset_key_string)
    except InvalidKeyError:
     LOGGER.info('In course %r, unable to parse asset key %r, not attempting to delete signatory.', course_key, asset_key_string)
     return
   else:
    LOGGER.info('In course %r, unable to parse asset key %r, not attempting to delete signatory.', course_key, asset_key_string)
    return
  try:
   delete_asset(course_key, asset_key)
  except AssetNotFoundException:
   pass

def _delete_asset ( course_key , asset_key_string ) : if asset_key_string : try : asset_key = AssetKey . from_string ( asset_key_string ) except InvalidKeyError : if ( '/' == asset_key_string [ 0 ] ) : asset_key_string = asset_key_string [ 1 : ] try : asset_key = AssetKey . from_string ( asset_key_string ) except InvalidKeyError : LOGGER . info ( 'In course %r, unable to parse asset key %r, not attempting to delete signatory.' , course_key , asset_key_string ) return else : LOGGER . info ( 'In course %r, unable to parse asset key %r, not attempting to delete signatory.' , course_key , asset_key_string ) return try : delete_asset ( course_key , asset_key ) except AssetNotFoundException : pass
internal method used to create asset key from string and remove asset by calling delete_asset method of assets module .