<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def migrate_hostname(dest_data: str, name: str):
 """ Write the machine name to a couple different places :param dest_data: The path to the root of ``/var`` in buildroot :param name: The name The hostname gets written to: - dest_path/hostname (bind mounted to /etc/hostname) (https://www.freedesktop.org/software/systemd/man/hostname.html#) - dest_path/machine-info as the PRETTY_HOSTNAME (bind mounted to /etc/machine-info) (https://www.freedesktop.org/software/systemd/man/machine-info.html#) - dest_path/serial since we assume the resin name is the serial number We also create some basic defaults for the machine-info. """

    if name.startswith('opentrons-'):
        name = name[len('opentrons-'):]
    LOG.info(
        f"migrate_hostname: writing name {name} to {dest_data}/hostname,"
        f" {dest_data}/machine-info, {dest_data}/serial")
    with open(os.path.join(dest_data, 'hostname'), 'w') as hn:
        hn.write(name + "\n")
    with open(os.path.join(dest_data, 'machine-info'), 'w') as mi:
        mi.write(f'PRETTY_HOSTNAME={name}\nDEPLOYMENT=production\n')
    with open(os.path.join(dest_data, 'serial'), 'w') as ser:
        ser.write(name)