#NEWLINE# def insert( self , i , * value , **key_and_value ) : #NEWLINE# #INDENT# "\n        Insert an item in the list at position i, either given as plain value\n        or as a keyword-arg pair.\n        Example:\n            taggedlist.insert(4, 'abc)\n        or\n            taggedlist.append(4, k='abc')\n        " #NEWLINE# if ( ( len ( value ) == 1 ) and ( not key_and_value ) ) : #NEWLINE# #INDENT# key = None #NEWLINE# value = value [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( len ( key_and_value ) == 1 ) and ( not value ) ) : #NEWLINE# #INDENT# [ ( key , value ) ] = key_and_value . items ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Only either one single value or one single pair of key/value is allowed' ) #NEWLINE# #UNINDENT# #UNINDENT# self . values . insert ( i , value ) #NEWLINE# self . keys . insert ( i , key )