<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getPDFstr(s):
 """ Return a PDF string depending on its coding. Notes: If only ascii then "(original)" is returned, else if only 8 bit chars then "(original)" with interspersed octal strings \nnn is returned, else a string "<FEFF[hexstring]>" is returned, where [hexstring] is the UTF-16BE encoding of the original. """

    if not bool(s):
        return "()"

    def make_utf16be(s):
        r = hexlify(bytearray([254, 255]) + bytearray(s, "UTF-16BE"))
        t = r if fitz_py2 else r.decode()
        return "<" + t + ">"                         # brackets indicate hex


# following either returns original string with mixed-in 
# octal numbers \nnn if outside ASCII range, or:
# exits with utf-16be BOM version of the string
    r = ""
    for c in s:
        oc = ord(c)
        if oc > 255:                                  # shortcut if beyond code range
            return make_utf16be(s)

        if oc > 31 and oc < 127:
            if c in ("(", ")", "\\"):
                r += "\\"
            r += c
            continue

        if oc > 127:
            r += "\\" + oct(oc)[-3:]
            continue

        if oc < 8 or oc > 13 or oc == 11 or c == 127:
            r += "\\267"   # indicate unsupported char
            continue

        if oc == 8:
            r += "\\b"
        elif oc == 9:
            r += "\\t"
        elif oc == 10:
            r += "\\n"
        elif oc == 12:
            r += "\\f"
        elif oc == 13:
            r += "\\r"

    return "(" + r + ")"