Implements the Update device Portals API.
            
            http://docs.exosite.com/portals/#update-device

def update_device(self, device_obj):
        """ Implements the Update device Portals API.
            
            http://docs.exosite.com/portals/#update-device
        """
        rid = device_obj['rid']
        device_obj['info']['description']['meta'] = \
                json.dumps(device_obj['info']['description']['meta'])
        headers = {
                'User-Agent': self.user_agent(),
        }
        headers.update(self.headers())

        r = requests.put(   self.portals_url()+'/devices/'+rid, 
                            data=json.dumps(device_obj),
                            headers=headers,
                            auth=self.auth())
        if HTTP_STATUS.OK == r.status_code:
            # fix the 'meta' to be dictionary instead of string
            updated_dev_obj = r.json()
            updated_dev_obj['info']['description']['meta'] =\
                            json.loads(device_obj['info']['description']['meta'])
            return updated_dev_obj
        else:
            print("update_device: Something went wrong: <{0}>: {1}".format(
                        r.status_code, r.reason))
            r.raise_for_status()