# Buggy code
def _parse_result(self, response, verbose=False):
    # if verbose is False then suppress any VOTable related warnings
    if not verbose:
        commons.suppress_vo_warnings()

    if "BATCH_RETRIEVAL_MSG ERROR:" in response.text:
        raise InvalidQueryError(
            "One or more inputs is not recognized by HEASARC. "
            "Check that the object name is in GRB, SIMBAD+Sesame, or "
            "NED format and that the mission name is as listed in "
            "query_mission_list()."
        )
    elif "Software error:" in response.text:
        raise InvalidQueryError(
            "Unspecified error from HEASARC database. "
            "\nCheck error message: \n{!s}".format(response.text)
        )

    try:
        data = BytesIO(response.content)
        table = Table.read(data, hdu=1)
        return table
    except ValueError:
        return self._fallback(response.content)


# Traceback (ValueError)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/anaconda3/envs/py36/lib/python3.6/site-packages/astroquery/heasarc/core.py in _parse_result(self, response, verbose)
223             data = BytesIO(response.content)
--> 224             table = Table.read(data, hdu=1)
225             return table

~/anaconda3/envs/py36/lib/python3.6/site-packages/astropy-4.1.dev27307-py3.6-macosx-10.7-x86_64.egg/astropy/table/connect.py in __call__(self, *args, **kwargs)
58
---> 59         out = registry.read(cls, *args, **kwargs)
60

~/anaconda3/envs/py36/lib/python3.6/site-packages/astropy-4.1.dev27307-py3.6-macosx-10.7-x86_64.egg/astropy/io/registry.py in read(cls, format, *args, **kwargs)
522         reader = get_reader(format, cls)
--> 523         data = reader(*args, **kwargs)
524

~/anaconda3/envs/py36/lib/python3.6/site-packages/astropy-4.1.dev27307-py3.6-macosx-10.7-x86_64.egg/astropy/io/fits/connect.py in read_table_fits(input, hdu, astropy_native, memmap, character_as_bytes)
215             return read_table_fits(hdulist, hdu=hdu,
--> 216                                    astropy_native=astropy_native)
217         finally:

~/anaconda3/envs/py36/lib/python3.6/site-packages/astropy-4.1.dev27307-py3.6-macosx-10.7-x86_64.egg/astropy/io/fits/connect.py in read_table_fits(input, hdu, astropy_native, memmap, character_as_bytes)
202         else:
--> 203             raise ValueError("No table found")
204

ValueError: No table found

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-10-7906b1189339> in <module>
----> 1 tab = he.query_region(coo, 'first', radius='1 degree')

~/anaconda3/envs/py36/lib/python3.6/site-packages/astroquery/utils/class_or_instance.py in f(*args, **kwds)
23         def f(*args, **kwds):
24             if obj is not None:
---> 25                 return self.fn(obj, *args, **kwds)
26             else:
27                 return self.fn(cls, *args, **kwds)

~/anaconda3/envs/py36/lib/python3.6/site-packages/astroquery/utils/process_asyncs.py in newmethod(self, *args, **kwargs)
27             if kwargs.get('get_query_payload') or kwargs.get('field_help'):
28                 return response
---> 29             result = self._parse_result(response, verbose=verbose)
30             self.table = result
31             return result

~/anaconda3/envs/py36/lib/python3.6/site-packages/astroquery/heasarc/core.py in _parse_result(self, response, verbose)
225             return table
226         except ValueError:
--> 227             return self._fallback(response.content)
228
229     def _args_to_payload(self, **kwargs):

~/anaconda3/envs/py36/lib/python3.6/site-packages/astroquery/heasarc/core.py in _fallback(self, content)
190         new_table = []
191
--> 192         old_table = content.split("END")[-1].strip()
193         for line in old_table.split("\n"):
194             newline = []

TypeError: a bytes-like object is required, not 'str'

# Fixed code
def _parse_result(self, response, verbose=False):
    # if verbose is False then suppress any VOTable related warnings
    if not verbose:
        commons.suppress_vo_warnings()

    if "BATCH_RETRIEVAL_MSG ERROR:" in response.text:
        raise InvalidQueryError(
            "One or more inputs is not recognized by HEASARC. "
            "Check that the object name is in GRB, SIMBAD+Sesame, or "
            "NED format and that the mission name is as listed in "
            "query_mission_list()."
        )
    elif "Software error:" in response.text:
        raise InvalidQueryError(
            "Unspecified error from HEASARC database. "
            "\nCheck error message: \n{!s}".format(response.text)
        )
    elif "NO MATCHING ROWS" in response.text:
        warnings.warn(NoResultsWarning("No matching rows were found in the query."))
        return Table()

    try:
        data = BytesIO(response.content)
        table = Table.read(data, hdu=1)
        return table
    except ValueError:
        return self._fallback(response.content)