def import_coldcard_wif(filename):
    """Reads a exported coldcard Wif text file and returns the WIF and used path"""
    next_var = ""
    import_password = ""
    path = ""
    with open(filename) as fp: 
        for line in fp:
            if line.strip() == "":
                continue
            if line.strip() == "WIF (privkey):":
                next_var = "wif"
                continue
            elif "Path Used" in line.strip():
                next_var = "path"
                continue
            if next_var == "wif":
                import_password = line.strip()
            elif next_var == "path":
                path = line
            next_var = ""
    return import_password, path.lstrip().replace("\n", "")