def fix_epoch(epoch):
 epoch = int(epoch)
 if (len(str(epoch)) <= 10):
  return epoch
 elif (len(str(epoch)) == 13):
  return int((epoch / 1000))
 elif ((len(str(epoch)) > 10) and (len(str(epoch)) < 13)):
  raise ValueError('Unusually formatted epoch timestamp.  Should be 10, 13, or more digits')
 else:
  orders_of_magnitude = (len(str(epoch)) - 10)
  powers_of_ten = (10 ** orders_of_magnitude)
  epoch = int((epoch / powers_of_ten))
 return epoch

def fix_epoch ( epoch ) : epoch = int ( epoch ) if ( len ( str ( epoch ) ) <= 10 ) : return epoch elif ( len ( str ( epoch ) ) == 13 ) : return int ( ( epoch / 1000 ) ) elif ( ( len ( str ( epoch ) ) > 10 ) and ( len ( str ( epoch ) ) < 13 ) ) : raise ValueError ( 'Unusually formatted epoch timestamp.  Should be 10, 13, or more digits' ) else : orders_of_magnitude = ( len ( str ( epoch ) ) - 10 ) powers_of_ten = ( 10 ** orders_of_magnitude ) epoch = int ( ( epoch / powers_of_ten ) ) return epoch
fix value of epoch to be epoch .