"""
    Parse datetime and return error message for invalid dates.
    :param v: the string value to be parsed
    :param allow_empty: Set True to return none if empty str or None
    """
    if allow_empty is True and not v:
        return None
    try:
        return timezone.parse(v)
    except (TypeError, ParserError):
        abort(400, f"Invalid datetime: {v!r}")
def node_dict(node_id, label, node_class):