code: function pyPop(obj, prop, defaultValue){
     obj = (obj === undefined) ? {} : obj;
  
     if(obj.hasOwnProperty(prop)){
         var rv =  obj[prop];
         delete obj[prop];
         return rv;
     } else {
         return defaultValue;
     }
  }
docs: like the python dictionary pop. return obj[prop] and remove property from obj. if obj[prop] doesn't exist, return default value.