def _escape_hive(val):
    """HiveParamEscaper

     https://github.com/dropbox/PyHive/blob/master/pyhive/hive.py"""
    return "'{0}'".format(val.replace('\\', '\\\\').replace("'", "\\'").
        replace('\r', '\\r').replace('\n', '\\n').replace('\t', '\\t'))
