#NEWLINE# def make_undefined_step_snippet( step , language = None ) : #NEWLINE# #INDENT# '\n    Helper function to create an undefined-step snippet for a step.\n\n    :param step: Step to use (as Step object or step text).\n    :param language: i18n language, optionally needed for step text parsing.\n    :return: Undefined-step snippet (as string).\n    ' #NEWLINE# if isinstance ( step , string_types ) : #NEWLINE# #INDENT# step_text = step #NEWLINE# steps = parser . parse_steps ( step_text , language = language ) #NEWLINE# step = steps [ 0 ] #NEWLINE# assert step , ( 'ParseError: %s' % step_text ) #NEWLINE# #UNINDENT# prefix = 'u' #NEWLINE# single_quote = "'" #NEWLINE# if ( single_quote in step . name ) : #NEWLINE# #INDENT# step . name = step . name . replace ( single_quote , "\\'" ) #NEWLINE# #UNINDENT# schema = "@%s(%s'%s')\ndef step_impl(context):\n" #NEWLINE# schema += "    raise NotImplementedError(%s'STEP: %s %s')\n\n" #NEWLINE# snippet = ( schema % ( step . step_type , prefix , step . name , prefix , step . step_type . title ( ) , step . name ) ) #NEWLINE# return snippet