In this code here: https://github.com/redis/redis-py/blob/v7.1.0/redis/commands/core.py#L4738-L4778
start/end are type hinted as int only, whereas when bylex (or byscore) is set to True, the value is expected to be prepended with [ or (, as stated both in the function's docstring and redis docs.
This can only be done if start/end are passed as a string or as bytes.
The hinting should be likely EncodableT.