#NEWLINE# def claim_case( domain , owner_id , host_id , host_type = None , host_name = None ) : #NEWLINE# #INDENT# if ( not ( host_type and host_name ) ) : #NEWLINE# #INDENT# case = CaseAccessors ( domain ) . get_case ( host_id ) #NEWLINE# host_type = case . type #NEWLINE# host_name = case . name #NEWLINE# #UNINDENT# identifier = DEFAULT_CASE_INDEX_IDENTIFIERS [ CASE_INDEX_EXTENSION ] #NEWLINE# claim_case_block = CaseBlock ( create = True , case_id = uuid4 ( ) . hex , case_name = host_name , case_type = CLAIM_CASE_TYPE , owner_id = owner_id , index = { #NEWLINE# #INDENT# identifier : IndexAttrs ( case_type = host_type , case_id = host_id , relationship = CASE_INDEX_EXTENSION ) , #NEWLINE# #UNINDENT# } ) . as_xml ( ) #NEWLINE# post_case_blocks ( [ claim_case_block ] , { #NEWLINE# #INDENT# 'domain' : domain , #NEWLINE# #UNINDENT# } )