python parsing functions