#NEWLINE# def maybe_name_or_idx( idx , model ) : #NEWLINE# #INDENT# '\n    Give a name or an integer and return the name and integer location of the\n    column in a design matrix.\n    ' #NEWLINE# if ( idx is None ) : #NEWLINE# #INDENT# idx = lrange ( model . exog . shape [ 1 ] ) #NEWLINE# #UNINDENT# if isinstance ( idx , int ) : #NEWLINE# #INDENT# exog_name = model . exog_names [ idx ] #NEWLINE# exog_idx = idx #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( idx , ( tuple , list ) ) : #NEWLINE# #INDENT# exog_name = [ ] #NEWLINE# exog_idx = [ ] #NEWLINE# for item in idx : #NEWLINE# #INDENT# ( exog_name_item , exog_idx_item ) = maybe_name_or_idx ( item , model ) #NEWLINE# exog_name . append ( exog_name_item ) #NEWLINE# exog_idx . append ( exog_idx_item ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# exog_name = idx #NEWLINE# exog_idx = model . exog_names . index ( idx ) #NEWLINE# #UNINDENT# #UNINDENT# return ( exog_name , exog_idx )