code: def convert_iso_time(i):
      
  
      t=i['iso_datetime']
  
      import datetime
      import time
  
      dto=None
  
      ok=True
  
      try: dto=datetime.datetime.strptime(t, "%Y-%m-%dT%H:%M:%S.%f")
      except Exception as e: 
         ok=False
         pass
  
      if not ok:
         ok=True
         try: dto=datetime.datetime.strptime(t, "%Y-%m-%dT%H:%M:%S")
         except Exception as e: 
            ok=False
            pass
  
      if not ok:
         ok=True
         try: dto=datetime.datetime.strptime(t, "%Y-%m-%dT%H:%M")
         except Exception as e: 
            ok=False
            pass
  
      if not ok:
         ok=True
         try: dto=datetime.datetime.strptime(t, "%Y-%m-%dT%H")
         except Exception as e: 
            ok=False
            pass
  
      if not ok:
         ok=True
         try: dto=datetime.datetime.strptime(t, "%Y-%m-%d")
         except Exception as e: 
            ok=False
            pass
  
      if not ok:
         ok=True
         try: dto=datetime.datetime.strptime(t, "%Y-%m")
         except Exception as e: 
            ok=False
            pass
  
      if not ok:
         ok=True
         try: dto=datetime.datetime.strptime(t, "%Y")
         except Exception as e: 
            return {'return':1, 'error':'can\'t parse ISO date time: '+t}
  
      return {'return':0, 'datetime_obj':dto}
docs: Input:  {
                iso_datetime - iso date time
              }
  
      Output: { 
                return         - return code =  0, if successful
                                             >  0, if error
                (error)        - error text if return > 0
                (datetime_obj) - datetime object
              }