def METHOD_NAME(self, string, encoding, evaluation: Evaluation):
    exp = Expression(SymbolToCharacterCode, string)
    if string.has_form("List", None):
        string = [substring.get_string_value() for substring in string.elements]
        if any(substring is None for substring in string):
            evaluation.message("ToCharacterCode", "strse", Integer1, exp)
            return None
    else:
        string = string.get_string_value()
        if string is None:
            evaluation.message("ToCharacterCode", "strse", Integer1, exp)
            return None
    if encoding == "Unicode":
        def convert(s):
            # FIXME: we can defined a custom conversion fn here
            return to_mathics_list(*[Integer(ord(code)) for code in s])
    else:
        py_encoding = to_python_encoding(encoding)
        if py_encoding is None:
            evaluation.message("General", "charcode", encoding)
            return
        def convert(s):
            # FIXME: we can defined a custom conversion fn here
            return to_mathics_list(
                *[Integer(x) for x in unpack_bytes(s.encode(py_encoding))]
            )
    if isinstance(string, list):
        return to_mathics_list(*string, elements_conversion_fn=convert)
    elif isinstance(string, str):
        return convert(string)