def __init__(self, ofc, fid="UNKNOWN", org="UNKNOWN", curdef=None,
                 lang="ENG", debug=False):
        self.ofc      = ofc
        self.fid      = fid
        self.org      = org
        self.curdef   = curdef
        self.lang     = lang
        self.debug    = debug

        self.bankid     = "UNKNOWN"
        self.accttype   = "UNKNOWN"
        self.acctid     = "UNKNOWN"
        self.balance    = "UNKNOWN"
        self.start_date = "UNKNOWN"
        self.end_date   = "UNKNOWN"

        self.parsed_ofc = None

        self.acct_types = { "0"  : "CHECKING",
                            "1"  : "SAVINGS",
                            "2"  : "CREDITCARD",
                            "3"  : "MONEYMRKT",
                            "4"  : "CREDITLINE",
                            "5"  : "UNKNOWN",
                            "6"  : "UNKNOWN",
                            "7"  : "UNKNOWN" }

        self.txn_types  = { "0"  : "CREDIT",
                            "1"  : "DEBIT",
                            "2"  : "INT",
                            "3"  : "DIV",
                            "4"  : "SRVCHG",
                            "5"  : "DEP",
                            "6"  : "ATM",
                            "7"  : "XFER",
                            "8"  : "CHECK",
                            "9"  : "PAYMENT",
                            "10" : "CASH",
                            "11" : "DIRECTDEP",
                            "12" : "OTHER" }

        if self.debug: sys.stderr.write("Parsing document.\n")

        parser = ofxtools.OfcParser(debug=debug)
        self.parsed_ofc = parser.parse(self.ofc)

        if self.debug: sys.stderr.write("Extracting document properties.\n")

        try:
            self.bankid     = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["ACCTFROM"]["BANKID"]
            acct_code       = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["ACCTFROM"]["ACCTTYPE"]
            self.accttype   = self.acct_types.get(acct_code, "UNKNOWN")
            self.acctid     = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["ACCTFROM"]["ACCTID"]
        except __HOLE__:
            self.bankid     = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["ACCTFROM"]["ACCOUNT"]["BANKID"]
            acct_code       = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["ACCTFROM"]["ACCOUNT"]["ACCTTYPE"]
            self.accttype   = self.acct_types.get(acct_code, "UNKNOWN")
            self.acctid     = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["ACCTFROM"]["ACCOUNT"]["ACCTID"]

        self.balance    = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["STMTRS"]["LEDGER"]
        self.start_date = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["STMTRS"]["DTSTART"]
        self.end_date   = self.parsed_ofc["document"]["OFC"]["ACCTSTMT"]["STMTRS"]["DTEND"]

    #
    # Conversion methods
    #
dataset/ETHPy150Open wesabe/fixofx/lib/ofxtools/ofc_converter.py/OfcConverter.__init__