code: def apply_escape_bytes(byte_data, escape, skip_printable=False):
      
  
      if isnumber(byte_data):
          if skip_printable:
              return num2bytes(byte_data)
          else:
              byte_data = num2bytes(byte_data)
      else:
          assert (isinstance(byte_data, type(b'')))
          if skip_printable and all(0x20 <= bval(ch) <= 0x7E for ch in byte_data):
              escape = STRING_ESCAPE_RAW
  
      if escape == STRING_ESCAPE_RAW:
          return byte_data
      elif escape == STRING_ESCAPE_PRINT:
          return escape_ascii_bytes(byte_data)
      elif escape == STRING_ESCAPE_UTF8:
          return codecs.encode(escape_utf8(byte_data), 'utf-8')
      elif escape == STRING_ESCAPE_BASE64:
          return base64.b64encode(byte_data)
      else:
          raise UnicodeEncodeError("Unknown escape option")
docs: Apply the specified escape method on the given bytes.
      :param byte_data: The byte-like object with bytes to escape.
      :param escape: The escape method to use.
      :param skip_printable: If True, don't escape byte_data with all 'printable ASCII' bytes. Defaults to False.
      :return: new bytes object with the escaped bytes or byte_data itself on some no-op cases.