# Import helpers as desired, or define your own, ie:
#from webhelpers.html.tags import checkbox, password
def importModuleFromFile(fullpath):
    """Loads  and returns module defined by the file path. Returns None if file could 
    not be loaded"""
    import os
    import sys
    import logging
    log = logging.getLogger(__name__)
    
    sys.path.append(os.path.dirname(fullpath))
    
    module = None
    try:
        module = __import__(os.path.splitext(os.path.basename(fullpath))[0])
 
    except Exception as ex:
        log.exception("Failed to load module:\n"+ex)
    finally:
        del sys.path[-1]
        return module

def convertToISO8601UTC (datetime=None):
    if datetime != None:
        return (datetime - datetime.utcoffset()).replace(tzinfo=None)
    return datetime
        
def convertToISO8601Zformat(datetime=None):
    if datetime != None:
        return ((datetime - datetime.utcoffset()).replace(tzinfo=None)).isoformat() + "Z" 
    return datetime


from datetime import datetime
import time
"""Helper functions

Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
# Import helpers as desired, or define your own, ie:
#from webhelpers.html.tags import checkbox, password
def importModuleFromFile(fullpath):
    """Loads  and returns module defined by the file path. Returns None if file could 
    not be loaded"""
    import os
    import sys
    import logging
    log = logging.getLogger(__name__)
    
    sys.path.append(os.path.dirname(fullpath))
    
    module = None
    try:
        module = __import__(os.path.splitext(os.path.basename(fullpath))[0])
 
    except Exception as ex:
        log.exception("Failed to load module:\n"+ex)
    finally:
        del sys.path[-1]
        return module

def convertToISO8601UTC (dateTimeArg=None):
    if isinstance(dateTimeArg, datetime) == True:
        return datetime.utcfromtimestamp(time.mktime(dateTimeArg.timetuple()))
    return dateTimeArg
        
def convertToISO8601Zformat(dateTimeArg=None):
    if isinstance(dateTimeArg, datetime) ==True:
        return convertToISO8601UTC (dateTimeArg).isoformat()+ "Z" 
    return dateTimeArg
    
def nowToISO8601Zformat():
    return convertToISO8601Zformat(datetime.now())

Add Method the return time now in complete UTC iso complete format
Add Method the return time now in complete UTC iso complete format

+ 
+ from datetime import datetime
+ import time
+ """Helper functions
+ 
+ Consists of functions to typically be used within templates, but also
+ available to Controllers. This module is available to templates as 'h'.
+ """
  # Import helpers as desired, or define your own, ie:
  #from webhelpers.html.tags import checkbox, password
  def importModuleFromFile(fullpath):
      """Loads  and returns module defined by the file path. Returns None if file could 
      not be loaded"""
      import os
      import sys
      import logging
      log = logging.getLogger(__name__)
      
      sys.path.append(os.path.dirname(fullpath))
      
      module = None
      try:
          module = __import__(os.path.splitext(os.path.basename(fullpath))[0])
   
      except Exception as ex:
          log.exception("Failed to load module:\n"+ex)
      finally:
          del sys.path[-1]
          return module
  
- def convertToISO8601UTC (datetime=None):
+ def convertToISO8601UTC (dateTimeArg=None):
-     if datetime != None:
-         return (datetime - datetime.utcoffset()).replace(tzinfo=None)
+     if isinstance(dateTimeArg, datetime) == True:
+         return datetime.utcfromtimestamp(time.mktime(dateTimeArg.timetuple()))
-     return datetime
+     return dateTimeArg
          
- def convertToISO8601Zformat(datetime=None):
+ def convertToISO8601Zformat(dateTimeArg=None):
-     if datetime != None:
-         return ((datetime - datetime.utcoffset()).replace(tzinfo=None)).isoformat() + "Z" 
+     if isinstance(dateTimeArg, datetime) ==True:
+         return convertToISO8601UTC (dateTimeArg).isoformat()+ "Z" 
-     return datetime
+     return dateTimeArg
+     
+ def nowToISO8601Zformat():
+     return convertToISO8601Zformat(datetime.now())
  
Add Method the return time now in complete UTC iso complete format
## Code Before:
# Import helpers as desired, or define your own, ie:
#from webhelpers.html.tags import checkbox, password
def importModuleFromFile(fullpath):
    """Loads  and returns module defined by the file path. Returns None if file could 
    not be loaded"""
    import os
    import sys
    import logging
    log = logging.getLogger(__name__)
    
    sys.path.append(os.path.dirname(fullpath))
    
    module = None
    try:
        module = __import__(os.path.splitext(os.path.basename(fullpath))[0])
 
    except Exception as ex:
        log.exception("Failed to load module:\n"+ex)
    finally:
        del sys.path[-1]
        return module

def convertToISO8601UTC (datetime=None):
    if datetime != None:
        return (datetime - datetime.utcoffset()).replace(tzinfo=None)
    return datetime
        
def convertToISO8601Zformat(datetime=None):
    if datetime != None:
        return ((datetime - datetime.utcoffset()).replace(tzinfo=None)).isoformat() + "Z" 
    return datetime

## Instruction:
Add Method the return time now in complete UTC iso complete format
## Code After:

from datetime import datetime
import time
"""Helper functions

Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
# Import helpers as desired, or define your own, ie:
#from webhelpers.html.tags import checkbox, password
def importModuleFromFile(fullpath):
    """Loads  and returns module defined by the file path. Returns None if file could 
    not be loaded"""
    import os
    import sys
    import logging
    log = logging.getLogger(__name__)
    
    sys.path.append(os.path.dirname(fullpath))
    
    module = None
    try:
        module = __import__(os.path.splitext(os.path.basename(fullpath))[0])
 
    except Exception as ex:
        log.exception("Failed to load module:\n"+ex)
    finally:
        del sys.path[-1]
        return module

def convertToISO8601UTC (dateTimeArg=None):
    if isinstance(dateTimeArg, datetime) == True:
        return datetime.utcfromtimestamp(time.mktime(dateTimeArg.timetuple()))
    return dateTimeArg
        
def convertToISO8601Zformat(dateTimeArg=None):
    if isinstance(dateTimeArg, datetime) ==True:
        return convertToISO8601UTC (dateTimeArg).isoformat()+ "Z" 
    return dateTimeArg
    
def nowToISO8601Zformat():
    return convertToISO8601Zformat(datetime.now())
