# Buggy code
def delete_service_certificate(kwargs=None, conn=None, call=None):
    """
    .. versionadded:: 2015.8.0

    Delete a specific certificate associated with the service

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f delete_service_certificate my-azure name=my_service_certificate \
            thumbalgorithm=sha1 thumbprint=0123456789ABCDEF
    """
    if call != "function":
        raise SaltCloudSystemExit(
            "The delete_service_certificate function must be called with -f or --function."
        )

    if kwargs is None:
        kwargs = {}

    if "name" not in kwargs:
        raise SaltCloudSystemExit('A name must be specified as "name"')

    if "thumbalgorithm" not in kwargs:
        raise SaltCloudSystemExit(
            'A thumbalgorithm must be specified as "thumbalgorithm"'
        )

    if "thumbprint" not in kwargs:
        raise SaltCloudSystemExit('A thumbprint must be specified as "thumbprint"')

    if not conn:
        conn = get_conn()

    try:
        data = conn.delete_service_certificate(
            kwargs["name"],
            kwargs["thumbalgorithm"],
            kwargs["thumbprint"],
        )
        return {"Success": "The service certificate was successfully deleted"}
    except WindowsAzureMissingResourceError as exc:
        return {"Error": exc.message}


# Traceback (TypeError)
# salt-cloud -f add_input_endpoint az-mysetup name=http    port=80    protocol=tcp deployment=myproject service=myproject role=myproject

Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/salt/cloud/cli.py", line 245, in run
self.function_provider, self.function_name, kwargs
File "/usr/local/lib/python2.7/site-packages/salt/cloud/__init__.py", line 1525, in do_function
call='function', kwargs=kwargs
File "/usr/local/lib/python2.7/site-packages/salt/cloud/clouds/msazure.py", line 2190, in add_input_endpoint
activity='add',
File "/usr/local/lib/python2.7/site-packages/salt/cloud/clouds/msazure.py", line 2109, in update_input_endpoint
old_endpoints = list_input_endpoints(kwargs, call='function')
File "/usr/local/lib/python2.7/site-packages/salt/cloud/clouds/msazure.py", line 2013, in list_input_endpoints
for item in data:
TypeError: 'NoneType' object is not iterable

# Fixed code
def delete_service_certificate(kwargs=None, conn=None, call=None):
    """
    .. versionadded:: 2015.8.0

    Delete a specific certificate associated with the service

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f delete_service_certificate my-azure name=my_service_certificate \\
            thumbalgorithm=sha1 thumbprint=0123456789ABCDEF
    """
    if call != "function":
        raise SaltCloudSystemExit(
            "The delete_service_certificate function must be called with -f or --function."
        )

    if kwargs is None:
        kwargs = {}

    if "name" not in kwargs:
        raise SaltCloudSystemExit('A name must be specified as "name"')

    if "thumbalgorithm" not in kwargs:
        raise SaltCloudSystemExit(
            'A thumbalgorithm must be specified as "thumbalgorithm"'
        )

    if "thumbprint" not in kwargs:
        raise SaltCloudSystemExit('A thumbprint must be specified as "thumbprint"')

    if not conn:
        conn = get_conn()

    try:
        data = conn.delete_service_certificate(
            kwargs["name"],
            kwargs["thumbalgorithm"],
            kwargs["thumbprint"],
        )
        return {"Success": "The service certificate was successfully deleted"}
    except WindowsAzureMissingResourceError as exc:
        return {"Error": exc.message}