Write python code to connect to a FTP server.
To connect to an FTP server in Python, you can use the built-in ftplib module. Here is an example function that connects to an FTP server:

```
import ftplib

def ftp_connect(host, username, password):
    ftp = ftplib.FTP(host)
    ftp.login(username, password)
    return ftp
```

In this function, host is the hostname or IP address of the FTP server, username and password are the login credentials for the FTP server. The ftp.login() method is used to authenticate the user with the FTP server. The function returns the FTP object, which can be used to perform operations on the FTP server, such as uploading or downloading files.

Here's an example of how to use this function to connect to an FTP server:

```
ftp = ftp_connect('ftp.example.com', 'username', 'password')
print(ftp.getwelcome())  # prints the welcome message from the FTP server
ftp.quit()  # disconnects from the FTP server
```

In this example, ftp.example.com is the hostname of the FTP server, and username and password are the login credentials. The ftp.getwelcome() method is used to print the welcome message from the FTP server. The ftp.quit() method is used to disconnect from the FTP server.
Now could you please also show me how to download a file? Is there a way to automatically handle disconnects during the download process or do I have to do it in my code?