def bgseq(code):
    """
    Returns the background color terminal escape sequence for the given color code number.
    """
    if isinstance(code, str):
        code = nametonum(code)

    if code == -1:
        return ""

    s = termcap.get('setab', code) or termcap.get('setb', code)
    return s
Returns the background color terminal escape sequence for the given color code number.