<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_string(_bytearray, byte_index, max_size):
 """ parse string from bytearray """

    size = _bytearray[byte_index + 1]

    if max_size < size:
        logger.error("the string is to big for the size encountered in specification")
        logger.error("WRONG SIZED STRING ENCOUNTERED")
        size = max_size

    data = map(chr, _bytearray[byte_index + 2:byte_index + 2 + size])
    return "".join(data)