def extract_tabular(self, result={}, table_type="rows", header=[], prefix="", suffix="", selector="", attr="text", default="", verbosity=0):
		"""
		Method for performing the extraction of tabular data.

		:param result:
		:param table_type:
		:param header:
		:param prefix:
		:param suffix:
		:param selector:
		:param attr:
		:param default:
		:param verbosity:
		:return: A 2-tuple containing the list of all the column headers extracted and the list of \
		dictionaries which contain (header, content) pairs
		"""
		result_list = []
		if type(header) in [str, unicode]:
			try:
				header_list = self.tree.xpath(header)
				table_headers = [prefix + h.text + suffix for h in header_list]
			except XPathError:
				raise Exception("Invalid XPath selector " + header)
		else:
			table_headers = [prefix + h + suffix for h in header]
		if table_type not in ["rows", "columns"]:
			raise Exception("Specify 'rows' or 'columns' in table_type")
		if table_type == "rows":
			try:
				values = self.tree.xpath(selector)
				if len(table_headers) >= len(values):
					from itertools import izip_longest
					pairs = izip_longest(table_headers, values, fillvalue=default)
				else:
					from itertools import izip
					pairs = izip(table_headers, values)
				for head, val in pairs:
					if verbosity > 1:
						print("\nExtracting", head, "attribute", sep=' ', end='')
					if attr == "text":
						try:
							content = " ".join([make_ascii(x).strip() for x in val.itertext()])
						except Exception:
							content = default
						content = content.replace("\n", " ").strip()
					else:
						content = val.get(attr)
						if attr in ["href", "src"]:
							content = urljoin(self.url, content)
					result[head] = content
				result_list.append(result)
			except XPathError:
				raise Exception("Invalid XPath selector " + selector)
			except TypeError:
				raise Exception("Selector expression string to be provided. Got " + selector)
		else:
			try:
				if type(selector) in [str, unicode]:
					selectors = [selector]
				elif type(selector) == list:
					selectors = selector
				else:
					raise Exception("Use a list of selector expressions for the various columns")
				from itertools import izip, count
				pairs = izip(table_headers, selectors)
				columns = {}
				for head, selector in pairs:
					columns[head] = self.tree.xpath(selector)
				try:
					for i in count(start=0):
						r = result.copy()
						for head in columns.keys():
							if verbosity > 1:
								print("\nExtracting", head, "attribute", sep=' ', end='')
							col = columns[head][i]
							if attr == "text":
								try:
									content = " ".join([make_ascii(x).strip() for x in col.itertext()])
								except Exception:
									content = default
								content = content.replace("\n", " ").strip()
							else:
								content = col.get(attr)
								if attr in ["href", "src"]:
									content = urljoin(self.url, content)
							r[head] = content
						result_list.append(r)
				except __HOLE__:
					pass
			except XPathError:
				raise Exception("Invalid XPath selector " + selector)
			except TypeError:
				raise Exception("Selector expression string to be provided. Got " + selector)
		return table_headers, result_list
dataset/ETHPy150Open AlexMathew/scrapple/scrapple/selectors/xpath.py/XpathSelector.extract_tabular