<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_binary(value, encoding='utf-8'):
 """Convert value to binary string, default encoding is utf-8 :param value: Value to be converted :param encoding: Desired encoding """

    if not value:
        return b''
    if isinstance(value, six.binary_type):
        return value
    if isinstance(value, six.text_type):
        return value.encode(encoding)
    return to_text(value).encode(encoding)