diff --git a/tabulate.py b/tabulate.py
index 92164fb..99b6118 100755
--- a/tabulate.py
+++ b/tabulate.py
@@ -1423,7 +1423,11 @@ def tabulate(
 
     has_invisible = re.search(_invisible_codes, plain_text)
     enable_widechars = wcwidth is not None and WIDE_CHARS_MODE
-    if tablefmt in multiline_formats and _is_multiline(plain_text):
+    if (
+        not isinstance(tablefmt, TableFormat)
+        and tablefmt in multiline_formats
+        and _is_multiline(plain_text)
+    ):
         tablefmt = multiline_formats.get(tablefmt, tablefmt)
         is_multiline = True
     else:

diff --git a/test/test_regression.py b/test/test_regression.py
index 8cdfcb2..e79aad8 100644
--- a/test/test_regression.py
+++ b/test/test_regression.py
@@ -4,7 +4,7 @@
 
 from __future__ import print_function
 from __future__ import unicode_literals
-from tabulate import tabulate, _text_type, _long_type
+from tabulate import tabulate, _text_type, _long_type, TableFormat, Line, DataRow
 from common import assert_equal, assert_in, SkipTest
 
 
@@ -365,3 +365,21 @@ def test_empty_pipe_table_with_columns():
     expected = "\n".join(["| Col1   | Col2   |", "|--------|--------|"])
     result = tabulate(table, headers, tablefmt="pipe")
     assert_equal(result, expected)
+
+
+def test_custom_tablefmt():
+    "Regression: allow custom TableFormat that specifies with_header_hide (github issue #20)"
+    tablefmt = TableFormat(
+        lineabove=Line("", "-", "  ", ""),
+        linebelowheader=Line("", "-", "  ", ""),
+        linebetweenrows=None,
+        linebelow=Line("", "-", "  ", ""),
+        headerrow=DataRow("", "  ", ""),
+        datarow=DataRow("", "  ", ""),
+        padding=0,
+        with_header_hide=["lineabove", "linebelow"],
+    )
+    rows = [["foo", "bar"], ["baz", "qux"]]
+    expected = "\n".join(["A    B", "---  ---", "foo  bar", "baz  qux"])
+    result = tabulate(rows, headers=["A", "B"], tablefmt=tablefmt)
+    assert_equal(result, expected)

Custom TableFormat gives: TypeError: unhashable type: 'list'
Cloned tabulate from master (433dfc69f2abba1c463763d33e1fb3bcdd3afe37) and tried to use custom TableFormat:

Script:

```
from tabulate import tabulate, TableFormat, Line, DataRow

tablefmt = TableFormat(
        lineabove        = Line("", "-", "  ", ""),
        linebelowheader  = Line("", "-", "  ", ""),
        linebetweenrows  = None,
        linebelow        = Line("", "-", "  ", ""),
        headerrow        = DataRow("", "  ", ""),
        datarow          = DataRow("", "  ", ""),
        padding          = 0,
        with_header_hide = ["lineabove", "linebelow"])

rows = [
    ['foo', 'bar'],
    ['baz', 'qux'] ]

print(tabulate(rows, headers=['A', 'B'], tablefmt=tablefmt))
```

Output:

```
Traceback (most recent call last):
  File "<stdin>", line 17, in <module>
  File "/home/woky/work/test/venv/lib/python3.7/site-packages/tabulate.py", line 1268, in tabulate
    if tablefmt in multiline_formats and _is_multiline(plain_text):
TypeError: unhashable type: 'list'
```

(I'm not the original issue submitter - this is copied from https://bitbucket.org/astanin/python-tabulate/issues/156/custom-tableformat-gives-typeerror)
test/test_regression.py::test_custom_tablefmt
test/test_regression.py::test_ansi_color_in_table_cells test/test_regression.py::test_alignment_of_colored_cells test/test_regression.py::test_iter_of_iters_with_headers test/test_regression.py::test_datetime_values test/test_regression.py::test_simple_separated_format test/test_regression.py::test_simple_separated_format_with_headers test/test_regression.py::test_column_type_of_bytestring_columns test/test_regression.py::test_numeric_column_headers test/test_regression.py::test_88_256_ANSI_color_codes test/test_regression.py::test_column_with_mixed_value_types test/test_regression.py::test_latex_escape_special_chars test/test_regression.py::test_isconvertible_on_set_values test/test_regression.py::test_ansi_color_for_decimal_numbers test/test_regression.py::test_alignment_of_decimal_numbers_with_ansi_color test/test_regression.py::test_long_integers test/test_regression.py::test_colorclass_colors test/test_regression.py::test_align_long_integers test/test_regression.py::test_boolean_columns test/test_regression.py::test_ansi_color_bold_and_fgcolor test/test_regression.py::test_empty_table_with_keys_as_header test/test_regression.py::test_escape_empty_cell_in_first_column_in_rst test/test_regression.py::test_ragged_rows test/test_regression.py::test_empty_pipe_table_with_columns