Implements: assignLicense
        https://msdn.microsoft.com/library/azure/ad/graph/api/functions-and-actions#assignLicense

        "add" is a dictionary of licence sku id's that reference an
        array of disabled plan id's
             add = { '<license-sku-id>': ['<disabled-plan-id'>, ...]
        "remove" is an array of license sku id's
             remove = ['<license-sku-id'>, ...]

def set_user_licenses(self, user, add=None, remove=None):
        """Implements: assignLicense
        https://msdn.microsoft.com/library/azure/ad/graph/api/functions-and-actions#assignLicense

        "add" is a dictionary of licence sku id's that reference an
        array of disabled plan id's
             add = { '<license-sku-id>': ['<disabled-plan-id'>, ...]
        "remove" is an array of license sku id's
             remove = ['<license-sku-id'>, ...]

        """  # noqa
        url = '/users/%s/assignLicense' % (user)
        add_licenses = []
        if add:
            for l in add:
                add_licenses.append({
                    'skuId': l,
                    'disabledPlans': add[l]
                })

        body = {
            'addLicenses': add_licenses,
            'removeLicenses': remove if remove else []
        }

        data = self.post_resource(url, json=body)
        return data