#NEWLINE# def _split_js( media , domain ) : #NEWLINE# #INDENT# '\n    Extract the local or external URLs from a Media object.\n    ' #NEWLINE# if ( not media . _js ) : #NEWLINE# #INDENT# return ImmutableMedia . empty_instance #NEWLINE# #UNINDENT# needs_local = ( domain == 'local' ) #NEWLINE# new_js = [ ] #NEWLINE# for url in media . _js : #NEWLINE# #INDENT# if ( needs_local == _is_local ( url ) ) : #NEWLINE# #INDENT# new_js . append ( url ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not new_js ) : #NEWLINE# #INDENT# return ImmutableMedia . empty_instance #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return Media ( js = new_js )