<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encode_scaled(data, size, version=0, level=QR_ECLEVEL_L, hint=QR_MODE_8, case_sensitive=True):
 """Creates a QR-code from string data, resized to the specified dimensions. Args: data: string: The data to encode in a QR-code. If a unicode string is supplied, it will be encoded in UTF-8. size: int: Output size. If this is not an exact multiple of the QR-code's dimensions, padding will be added. If this is smaller than the QR-code's dimensions, it is ignored. version: int: The minimum version to use. If set to 0, the library picks the smallest version that the data fits in. level: int: Error correction level. Defaults to 'L'. hint: int: The type of data to encode. Either QR_MODE_8 or QR_MODE_KANJI. case_sensitive: bool: Should string data be encoded case-preserving? Returns: A (version, size, image) tuple, where image is a size*size PIL image of the QR-code. """

    version, src_size, im = encode(data, version, level, hint, case_sensitive)
    if size < src_size:
      size = src_size
    qr_size = (size / src_size) * src_size
    im = im.resize((qr_size, qr_size), Image.NEAREST)
    pad = (size - qr_size) / 2
    ret = Image.new("L", (size, size), 255)
    ret.paste(im, (pad, pad))
    
    return (version, size, ret)