<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bytes_cast(maybe_str, encoding='utf-8'):
 """ Converts any string-like input to a bytes-like output, with respect to python version Parameters maybe_str : if this is a string-like object, it will be converted to bytes encoding : str, default='utf-8' encoding to be used when encoding string """

    if isinstance(maybe_str, unicode_):
        return maybe_str.encode(encoding)
    else:
        return maybe_str