def calendar_id2real_id(calendar_id=None, with_date=False):
 if (calendar_id and isinstance(calendar_id, basestring)):
  res = filter(None, calendar_id.split('-'))
  if (len(res) == 2):
   real_id = res[0]
   if with_date:
    real_date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT, time.strptime(res[1], VIRTUALID_DATETIME_FORMAT))
    start = datetime.strptime(real_date, DEFAULT_SERVER_DATETIME_FORMAT)
    end = (start + timedelta(hours=with_date))
    return (int(real_id), real_date, end.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
   return int(real_id)
 return ((calendar_id and int(calendar_id)) or calendar_id)

def calendar_id2real_id ( calendar_id = None , with_date = False ) : if ( calendar_id and isinstance ( calendar_id , basestring ) ) : res = filter ( None , calendar_id . split ( '-' ) ) if ( len ( res ) == 2 ) : real_id = res [ 0 ] if with_date : real_date = time . strftime ( DEFAULT_SERVER_DATETIME_FORMAT , time . strptime ( res [ 1 ] , VIRTUALID_DATETIME_FORMAT ) ) start = datetime . strptime ( real_date , DEFAULT_SERVER_DATETIME_FORMAT ) end = ( start + timedelta ( hours = with_date ) ) return ( int ( real_id ) , real_date , end . strftime ( DEFAULT_SERVER_DATETIME_FORMAT ) ) return int ( real_id ) return ( ( calendar_id and int ( calendar_id ) ) or calendar_id )
convert a "virtual/recurring event id" into a real event id .