def to_bytes(value) :
    """
    Decodes value to bytes.
    
    Args:
        value : Value to decode to bytes

    Returns:
        :obj:`bytes` : Return the value as bytes:

            if type(value) is :obj:`bytes`, return value;

            if type(value) is :obj:`str`, return the string encoded with UTF-8;

            otherwise, returns bytes(value).
    """
    if value is None :
        return value
    elif type(value) is bytes :
        return value
    elif type(value) is str :
        return value.encode('utf-8')
    else :
        return bytes(value)