# Path: ififuncs.py
# def append_csv(csv_file, *args):
#     f = open(csv_file, 'a', newline='')
#     try:
#         writer = csv.writer(f)
#         writer.writerow(*args)
#     finally:
#         f.close()
# 
# Path: ififuncs.py
# def create_csv(csv_file, *args):
#     f = open(csv_file, 'w', newline='')
#     try:
#         writer = csv.writer(f)
#         writer.writerow(*args)
#     finally:
#         f.close()


import lxml.etree as ET
import lxml.builder as builder
import uuid
import time
import sys
import subprocess
import os
import hashlib
import csv
from glob import glob
from collections import OrderedDict
from ififuncs import append_csv
from ififuncs import create_csv
        event_DateTime                      = ET.Element("{%s}eventDateTime" % (premis_namespace))
        event.insert(3,event_DateTime)
        if event_time == 'now':
            event_DateTime.text             = time.strftime("%Y-%m-%dT%H:%M:%S")
        else:
            event_DateTime.text             = event_time
        event_Type.text                     = event_type
        event_id_value.text                 = eventID
        event_id_type.text                  = 'UUID'
        eventDetailInformation              = create_unit(4,event,'eventDetailInformation')
        eventDetail                         = create_unit(0,eventDetailInformation,'eventDetail')
        eventDetail.text                    = event_detail
        for i in eventLinkingObjectIdentifier:
            linkingObjectIdentifier             = create_unit(5,event,'linkingObjectIdentifier')
            linkingObjectIdentifierType         = create_unit(0,linkingObjectIdentifier,'linkingObjectIdentifierType')
            linkingObjectIdentifierValue        = create_unit(1,linkingObjectIdentifier,'linkingObjectIdentifierValue')
            linkingObjectIdentifierValue.text   = i
            linkingObjectRole                   = create_unit(2,linkingObjectIdentifier,'linkingObjectRole')
            linkingObjectIdentifierType.text    = 'UUID'
            linkingObjectRole.text              = eventLinkingObjectRole
        for i in agentlist:
            linkingAgentIdentifier              = create_unit(-1,event,'linkingAgentIdentifier')
            linkingAgentIdentifierType          = create_unit(0,linkingAgentIdentifier,'linkingAgentIdentifierType')
            linkingAgentIdentifierValue         = create_unit(1,linkingAgentIdentifier,'linkingAgentIdentifierValue')
            linkingAgentIdentifierRole          = create_unit(2,linkingAgentIdentifier,'linkingAgentRole')
            linkingAgentIdentifierRole.text     = 'implementer'
            linkingAgentIdentifierType.text     = i[0]
            linkingAgentIdentifierValue.text    = i[1]



# Path: ififuncs.py
# def append_csv(csv_file, *args):
#     f = open(csv_file, 'a', newline='')
#     try:
#         writer = csv.writer(f)
#         writer.writerow(*args)
#     finally:
#         f.close()
# 
# Path: ififuncs.py
# def create_csv(csv_file, *args):
#     f = open(csv_file, 'w', newline='')
#     try:
#         writer = csv.writer(f)
#         writer.writerow(*args)
#     finally:
#         f.close()


# Path: premis.py
import lxml.etree as ET
import lxml.builder as builder
import uuid
import time
import sys
import subprocess
import os
import hashlib
import csv
from glob import glob
from collections import OrderedDict
from ififuncs import append_csv
from ififuncs import create_csv

        event_DateTime                      = ET.Element("{%s}eventDateTime" % (premis_namespace))
        event.insert(3,event_DateTime)
        if event_time == 'now':
            event_DateTime.text             = time.strftime("%Y-%m-%dT%H:%M:%S")
        else:
            event_DateTime.text             = event_time
        event_Type.text                     = event_type
        event_id_value.text                 = eventID
        event_id_type.text                  = 'UUID'
        eventDetailInformation              = create_unit(4,event,'eventDetailInformation')
        eventDetail                         = create_unit(0,eventDetailInformation,'eventDetail')
        eventDetail.text                    = event_detail
        for i in eventLinkingObjectIdentifier:
            linkingObjectIdentifier             = create_unit(5,event,'linkingObjectIdentifier')
            linkingObjectIdentifierType         = create_unit(0,linkingObjectIdentifier,'linkingObjectIdentifierType')
            linkingObjectIdentifierValue        = create_unit(1,linkingObjectIdentifier,'linkingObjectIdentifierValue')
            linkingObjectIdentifierValue.text   = i
            linkingObjectRole                   = create_unit(2,linkingObjectIdentifier,'linkingObjectRole')
            linkingObjectIdentifierType.text    = 'UUID'
            linkingObjectRole.text              = eventLinkingObjectRole
        for i in agentlist:
            linkingAgentIdentifier              = create_unit(-1,event,'linkingAgentIdentifier')
            linkingAgentIdentifierType          = create_unit(0,linkingAgentIdentifier,'linkingAgentIdentifierType')
            linkingAgentIdentifierValue         = create_unit(1,linkingAgentIdentifier,'linkingAgentIdentifierValue')
            linkingAgentIdentifierRole          = create_unit(2,linkingAgentIdentifier,'linkingAgentRole')
            linkingAgentIdentifierRole.text     = 'implementer'
            linkingAgentIdentifierType.text     = i[0]
            linkingAgentIdentifierValue.text    = i[1]



def main():