'Parse a datetime string according to this calendar
@param dtstr: the datetime as string
@param dtfmt: the datetime format (strptime)
@param local: whether the default format is local (=deployment
setting) or ISO
@return: the datetime (datetime.datetime)'

def parse_datetime(self, dtstr, dtfmt=None, local=False):

    if (dtstr is None):
        return None
    if (dtfmt is None):
        if local:
            dtfmt = current.deployment_settings.get_L10n_datetime_format()
        else:
            dtfmt = ISOFORMAT
    calendar = self.calendar
    try:
        timetuple = calendar._parse(dtstr, dtfmt)
    except (ValueError, TypeError):
        return None
    timetuple = calendar._gdate(timetuple)
    dt = datetime.datetime(*timetuple)
    return dt
