def get_file_stat(path):
 try:
  stats = os.stat(path)
 except IOError as e:
  raise ValueError(('Could not retrieve file stat of "%s": %s' % (path, e)))
 try:
  update_time = datetime.fromtimestamp(stats.st_mtime, tzlocal())
 except (ValueError, OSError, OverflowError):
  update_time = None
 return (stats.st_size, update_time)

def get_file_stat ( path ) : try : stats = os . stat ( path ) except IOError as e : raise ValueError ( ( 'Could not retrieve file stat of "%s": %s' % ( path , e ) ) ) try : update_time = datetime . fromtimestamp ( stats . st_mtime , tzlocal ( ) ) except ( ValueError , OSError , OverflowError ) : update_time = None return ( stats . st_size , update_time )
this is a helper function that given a local path return the size of the file in bytes and time of last modification .