def connect():
ftp_class = ftplib.FTP if not SSL else ftplib.FTP_TLS<EOL>ftp = ftp_class(timeout=TIMEOUT)<EOL>ftp.connect(HOST, PORT)<EOL>ftp.login(USER, PASSWORD)<EOL>if SSL:<EOL><INDENT>ftp.prot_p()  <EOL><DEDENT>return ftp<EOL>
Connect to FTP server, login and return an ftplib.FTP instance.