def base64_url_decode_php_style(inp):
 import base64
 padding_factor = ((4 - (len(inp) % 4)) % 4)
 inp += ('=' * padding_factor)
 return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/'))))

def base64_url_decode_php_style ( inp ) : import base64 padding_factor = ( ( 4 - ( len ( inp ) % 4 ) ) % 4 ) inp += ( '=' * padding_factor ) return base64 . b64decode ( unicode ( inp ) . translate ( dict ( zip ( map ( ord , u'-_' ) , u'+/' ) ) ) )
php follows a slightly different protocol for base64 url decode .