#NEWLINE# def get_parser( step_name ) : #NEWLINE# #INDENT# 'Get parser by given name.\n\n    :param step_name: name of the step to parse\n\n    :return: step parser object\n    :rtype: StepArgumentParser\n    ' #NEWLINE# if isinstance ( step_name , RE_TYPE ) : #NEWLINE# #INDENT# warn = 'pytest-bdd [{0}]: Direct usage of regex is deprecated. Please use pytest_bdd.parsers.re instead.' . format ( step_name . pattern ) #NEWLINE# warnings . warn ( warn ) #NEWLINE# print ( warn ) #NEWLINE# return re ( step_name . pattern , flags = step_name . flags ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( step_name , six . string_types ) : #NEWLINE# #INDENT# return string ( step_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not hasattr ( step_name , 'is_matching' ) ) or ( not hasattr ( step_name , 'parse_arguments' ) ) ) : #NEWLINE# #INDENT# raise InvalidStepParserError ( step_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return step_name