def _typecast(self, input: Any, context: dict[(str, Any)]={}) -> tuple[(Optional[int], list[Error])]:
    if isinstance(input, int):
        return (input, [])
    if (not isinstance(input, str)):
        return (None, [self._error('unexpected_type', {'expected_type': type_name('int')})])
    try:
        return (int(input), [])
    except ValueError:
        return (None, [self._error('invalid_integer_format')])
def _typecast(self, input: Any, context: dict[(str, Any)]={}) -> tuple[(Optional[int], list[Error])]:
    if isinstance(input, int):
        return (input, [])
    if (not isinstance(input, str)):
        return (None, [self._error('unexpected_type', {'expected_type': type_name('int')})])
    try:
        return (int(input), [])
    except ValueError:
        return (None, [self._error('invalid_integer_format')])