def finalize(filename, content_type=RAW):
 if (not filename):
  raise InvalidArgumentError('Filename is empty')
 if (not isinstance(filename, basestring)):
  raise InvalidArgumentError('Filename should be a string')
 if (content_type != RAW):
  raise InvalidArgumentError('Invalid content type')
 try:
  f = open(filename, 'a', exclusive_lock=True, content_type=content_type)
  f.close(finalize=True)
 except FinalizationError:
  pass

def finalize ( filename , content_type = RAW ) : if ( not filename ) : raise InvalidArgumentError ( 'Filename is empty' ) if ( not isinstance ( filename , basestring ) ) : raise InvalidArgumentError ( 'Filename should be a string' ) if ( content_type != RAW ) : raise InvalidArgumentError ( 'Invalid content type' ) try : f = open ( filename , 'a' , exclusive_lock = True , content_type = content_type ) f . close ( finalize = True ) except FinalizationError : pass
resolve conflicts and assign keys to every action in shortcuts .