def quote(name): """Return quoted name according to the DAP specification. >>> quote("White space") 'White%20space' >>> quote("Period.") 'Period%2E' """ safe = '%_!~*\'-"' return quote_(name.encode('utf-8'), safe=safe).replace('.', '%2E')