import ftplib


def connectToFTP(host, usern, passw,verb):
    """
    Creates an FTP Connection with the given details using FTPLib.

    :param host: Hostname (e.g. IP address) of the connection
    :param usern: Username to login with
    :param passw: password
    :param verb: print errors or not.
    :return: FTP Connection object. Success:1, Failure:0
    """
    try:
        ftp = ftplib.FTP(host, usern, passw)
        ftp.encoding = "utf-8"
        ftp.set_pasv(False)
    except Exception as e:
        if verb:
            print(e)
            print("\nERROR while creating FTP Connection \n")
        return None,0
    return ftp,1