def textfsm_extractor(cls, template_name, raw_text):
textfsm_data = list()<EOL>fsm_handler = None<EOL>for c in cls.__class__.mro():<EOL><INDENT>if c is object:<EOL><INDENT>continue<EOL><DEDENT>current_dir = os.path.dirname(<EOL>os.path.abspath(sys.modules[c.__module__].__file__)<EOL>)<EOL>template_dir_path = "<STR_LIT>".format(<EOL>current_dir=current_dir<EOL>)<EOL>template_path = "<STR_LIT>".format(<EOL>template_dir_path=template_dir_path, template_name=template_name<EOL>)<EOL>try:<EOL><INDENT>with open(template_path) as f:<EOL><INDENT>fsm_handler = textfsm.TextFSM(f)<EOL>for obj in fsm_handler.ParseText(raw_text):<EOL><INDENT>entry = {}<EOL>for index, entry_value in enumerate(obj):<EOL><INDENT>entry[fsm_handler.header[index].lower()] = entry_value<EOL><DEDENT>textfsm_data.append(entry)<EOL><DEDENT>return textfsm_data<EOL><DEDENT><DEDENT>except IOError:  <EOL><INDENT>continue  <EOL><DEDENT>except textfsm.TextFSMTemplateError as tfte:<EOL><INDENT>raise napalm.base.exceptions.TemplateRenderException(<EOL>"<STR_LIT>".format(<EOL>template_name=template_name, error=py23_compat.text_type(tfte)<EOL>)<EOL>)<EOL><DEDENT><DEDENT>raise napalm.base.exceptions.TemplateNotImplemented(<EOL>"<STR_LIT>".format(<EOL>template_name=template_name, path=template_dir_path<EOL>)<EOL>)<EOL>
Applies a TextFSM template over a raw text and return the matching table.

Main usage of this method will be to extract data form a non-structured output
from a network device and return the values in a table format.

:param cls: Instance of the driver class
:param template_name: Specifies the name of the template to be used
:param raw_text: Text output as the devices prompts on the CLI
:return: table-like list of entries