def METHOD_NAME(self, m, input_encoding=None, output_encoding=None, errors="strict"):
    # encode a give unicode type or string type to string type in encoding
    # output_encoding
    # check if input is not type unicode
    if not isinstance(m, str):
        if input_encoding is None:
            input_encoding = "utf-8"
        m = str(str(m), input_encoding, errors)
    if output_encoding is None:
        output_encoding = "utf-8"
    # return as type string
    return m.METHOD_NAME(output_encoding, errors)