def Func(arg_0, arg_1):
        '''
        Retrieves the notification hubs in the service namespace.

        name:
            Name of the service bus namespace.
        '''
        arg_2 = arg_0._perform_get(
            arg_0._get_Func_path(arg_1),
            None)

        return _MinidomXmlToObject.convert_response_to_feeds(
            arg_2,
            partial(
                _MinidomXmlToObject.convert_xml_to_azure_object,
                azure_type=NotificationHubDescription
            )
        )


def Func(arg_0, arg_1):
        '''
        Retrieves the relays in the service namespace.

        name:
            Name of the service bus namespace.
        '''
        arg_2 = arg_0._perform_get(
            arg_0._get_Func_path(arg_1),
            None)

        return _MinidomXmlToObject.convert_response_to_feeds(
            arg_2,
            partial(
                _MinidomXmlToObject.convert_xml_to_azure_object,
                azure_type=RelayDescription
            )
        )


def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        This operation gets rollup data for Service Bus metrics queue.
        Rollup data includes the time granularity for the telemetry aggregation as well as
        the retention settings for each time granularity.

        name:
            Name of the service bus namespace.
        queue_name:
            Name of the service bus queue in this namespace.
        metric:
            name of a supported metric
        '''
        arg_4 = arg_0._perform_get(
            arg_0._get_get_metrics_rollup_queue_path(arg_1, arg_2, arg_3),
            None)

        return _MinidomXmlToObject.convert_response_to_feeds(
            arg_4,
            partial(
                _ServiceBusManagementXmlSerializer.xml_to_metrics,
                object_type=MetricRollups
            )
        )


def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        This operation gets rollup data for Service Bus metrics topic.
        Rollup data includes the time granularity for the telemetry aggregation as well as
        the retention settings for each time granularity.

        name:
            Name of the service bus namespace.
        topic_name:
            Name of the service bus queue in this namespace.
        metric:
            name of a supported metric
        '''
        arg_4 = arg_0._perform_get(
            arg_0._get_get_metrics_rollup_topic_path(arg_1, arg_2, arg_3),
            None)

        return _MinidomXmlToObject.convert_response_to_feeds(
            arg_4,
            partial(
                _ServiceBusManagementXmlSerializer.xml_to_metrics,
                object_type=MetricRollups
            )
        )


def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        This operation gets rollup data for Service Bus metrics relay.
        Rollup data includes the time granularity for the telemetry aggregation as well as
        the retention settings for each time granularity.

        name:
            Name of the service bus namespace.
        relay_name:
            Name of the service bus relay in this namespace.
        metric:
            name of a supported metric
        '''
        arg_4 = arg_0._perform_get(
            arg_0._get_get_metrics_rollup_relay_path(arg_1, arg_2, arg_3),
            None)

        return _MinidomXmlToObject.convert_response_to_feeds(
            arg_4,
            partial(
                _ServiceBusManagementXmlSerializer.xml_to_metrics,
                object_type=MetricRollups
            )
        )


def Func(arg_0, arg_1=False, arg_2=False,
                    arg_3=False, arg_4=False, arg_5=None):
    """Create a virtual environment in a directory."""
    arg_6 = ExtendedEnvBuilder(arg_1=arg_1,
                                 arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,
                                 arg_5=arg_5)
    arg_6.Func(arg_0)
    return arg_6.context


def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        Create a new Azure SQL Database server.

        admin_login:
            The administrator login name for the new server.
        admin_password:
            The administrator login password for the new server.
        location:
            The region to deploy the new server.
        '''
        _validate_not_none('admin_login', arg_1)
        _validate_not_none('admin_password', arg_2)
        _validate_not_none('location', arg_3)
        arg_4 = arg_0.perform_post(
            arg_0._get_servers_path(),
            _SqlManagementXmlSerializer.Func_to_xml(
                arg_1,
                arg_2,
                arg_3
            )
        )

        return _SqlManagementXmlSerializer.xml_to_Func_response(
            arg_4.body)


def Func(arg_0, arg_1, arg_2):
        '''
        Reset the administrator password for a server.

        server_name:
            Name of the server to change the password.
        admin_password:
            The new administrator password for the server.
        '''
        _validate_not_none('server_name', arg_1)
        _validate_not_none('admin_password', arg_2)
        return arg_0._perform_post(
            arg_0._get_servers_path(arg_1) + '?op=ResetPassword',
            _SqlManagementXmlSerializer.Func_to_xml(
                arg_2
            )
        )


def Func(arg_0, arg_1):
        '''
        Gets quotas for an Azure SQL Database Server.

        server_name:
            Name of the server.
        '''
        _validate_not_none('server_name', arg_1)
        arg_2 = arg_0._perform_get(arg_0._get_quotas_path(arg_1),
                                     None)
        return _MinidomXmlToObject.parse_service_resources_response(
            arg_2, ServerQuota)


def Func(arg_0, arg_1, arg_2,
                              arg_3, arg_4=''):
        '''
        Gets the event logs for an Azure SQL Database Server.

        server_name:
            Name of the server to retrieve the event logs from.
        start_date:
            The starting date and time of the events to retrieve in UTC format,
            for example '2011-09-28 16:05:00'.
        interval_size_in_minutes:
            Size of the event logs to retrieve (in minutes).
            Valid values are: 5, 60, or 1440.
        event_types:
            The event type of the log entries you want to retrieve.
            Valid values are:
                - connection_successful
                - connection_failed
                - connection_terminated
                - deadlock
                - throttling
                - throttling_long_transaction
            To return all event types pass in an empty string.
        '''
        _validate_not_none('server_name', arg_1)
        _validate_not_none('start_date', arg_2)
        _validate_not_none('interval_size_in_minutes', arg_3)
        _validate_not_none('event_types', arg_4)
        arg_5 = arg_0._Func_path(arg_1) + \
               '?startDate={0}&intervalSizeInMinutes={1}&eventTypes={2}'.format(
            arg_2, arg_3, arg_4)
        arg_6 = arg_0._perform_get(arg_5, None)
        return _MinidomXmlToObject.parse_service_resources_response(
            arg_6, EventLog)


def Func(arg_0, arg_1, arg_2, arg_3=None,
                        arg_4=None, arg_5=None,
                        arg_6=None):
        '''
        Updates existing database details.

        server_name:
            Name of the server to contain the new database.
        name:
            Required. The name for the new database. See Naming Requirements
            in Azure SQL Database General Guidelines and Limitations and
            Database Identifiers for more information.
        new_database_name:
            Optional. The new name for the new database.
        service_objective_id:
            Optional. The new service level to apply to the database. For more
            information about service levels, see Azure SQL Database Service
            Tiers and Performance Levels. Use List Service Level Objectives to
            get the correct ID for the desired service objective.
        edition:
            Optional. The new edition for the new database.
        max_size_bytes:
            Optional. The new size of the database in bytes. For information on
            available sizes for each edition, see Azure SQL Database Service
            Tiers (Editions).
        '''
        _validate_not_none('server_name', arg_1)
        _validate_not_none('name', arg_2)
        return arg_0._perform_put(
            arg_0._get_databases_path(arg_1, arg_2),
            _SqlManagementXmlSerializer.Func_to_xml(
                arg_3, arg_4, arg_5,
                arg_6
            )
        )


def Func(arg_0, arg_1, arg_2):
        '''
        Deletes an Azure SQL Database.

        server_name:
            Name of the server where the database is located.
        name:
            Name of the database to delete.
        '''
        return arg_0._perform_delete(arg_0._get_databases_path(arg_1, arg_2))


def Func(arg_0, arg_1):
        '''
        List the SQL databases defined on the specified server name
        '''
        arg_2 = arg_0._perform_get(arg_0._get_Func_path(arg_1),
                                     None)
        return _MinidomXmlToObject.parse_service_resources_response(
            arg_2, Database)


async def Func(arg_0, arg_1=None):
        """Close down the handler connection.

        If the handler has already Funcd,
        this operation will do nothing. An optional exception can be passed in to
        indicate that the handler was shutdown due to error.
        It is recommended to open a handler within a context manager as
        opposed to calling the method directly.

        .. note:: This operation is not thread-safe.

        :param exception: An optional exception if the handler is closing
         due to an error.
        :type exception: Exception

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START open_Func_sender_directly]
                :end-before: [END open_Func_sender_directly]
                :language: python
                :dedent: 4
                :caption: Explicitly open and Func a Sender.

        """
        arg_0.running = False
        if arg_0.error:
            return
        if isinstance(arg_1, ServiceBusError):
            arg_0.error = arg_1
        elif arg_1:
            arg_0.error = ServiceBusError(str(arg_1))
        else:
            arg_0.error = ServiceBusError("This message handler is now Funcd.")
        await arg_0._handler.Func_async()


async def Func(arg_0, arg_1=None):
        """Close down the receiver connection.

        If the receiver has already Funcd, this operation will do nothing. An optional
        exception can be passed in to indicate that the handler was shutdown due to error.
        It is recommended to open a handler within a context manager as
        opposed to calling the method directly.
        The receiver will be implicitly Funcd on completion of the message iterator,
        however this method will need to be called explicitly if the message iterator is not run
        to completion.

        .. note:: This operation is not thread-safe.

        :param exception: An optional exception if the handler is closing
         due to an error.
        :type exception: Exception

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START open_Func_receiver_directly]
                :end-before: [END open_Func_receiver_directly]
                :language: python
                :dedent: 4
                :caption: Iterate then explicitly Func a Receiver.

        """
        if not arg_0.running:
            return
        arg_0.running = False
        arg_0.receiver_shutdown = True
        arg_0._used.set()
        await super(Receiver, arg_0).Func(arg_1=arg_1)


async def Func(arg_0):
        """Get the session state.

        Returns None if no state has been set.

        :rtype: str

        Example:
            .. literalinclude:: ../examples/async_examples/test_examples_async.py
                :start-after: [START set_session_state]
                :end-before: [END set_session_state]
                :language: python
                :dedent: 4
                :caption: Getting and setting the state of a session.

        """
        await arg_0._can_run()
        arg_1 = await arg_0._mgmt_request_response(
            REQUEST_RESPONSE_GET_SESSION_STATE_OPERATION,
            {'session-id': arg_0.session_id},
            mgmt_handlers.default)
        arg_2 = arg_1.get(b'session-state')
        if isinstance(arg_2, six.binary_type):
            arg_2 = arg_2.decode('UTF-8')
        return arg_2


def Func(arg_0, arg_1):
        """ Verifies that the challenge is a Bearer challenge and returns the key=value pairs. """
        arg_2 = 'Bearer '
        if not arg_1:
            raise ValueError('Challenge cannot be empty')

        arg_1 = arg_1.strip()
        if not arg_1.startswith(arg_2):
            raise ValueError('Challenge is not Bearer')

        return arg_1[len(arg_2):]


def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6=False, arg_7=True, **arg_8):
        """Purges data in an Log Analytics workspace by a set of user-defined
        filters.

        :param resource_group_name: The name of the resource group to get. The
         name is case insensitive.
        :type resource_group_name: str
        :param workspace_name: Log Analytics workspace name
        :type workspace_name: str
        :param table: Table from which to Func data.
        :type table: str
        :param filters: The set of columns and filters (queries) to run over
         them to Func the resulting data.
        :type filters:
         list[~azure.mgmt.loganalytics.models.WorkspacePurgeBodyFilters]
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns object or
         ClientRawResponse<object> if raw==True
        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]]
        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
        """
        arg_9 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=True,
            **arg_8
        )

        def get_long_running_output(arg_10):
            arg_11 = arg_0._deserialize('object', arg_10)

            if arg_6:
                arg_12 = ClientRawResponse(arg_11, arg_10)
                return arg_12

            return arg_11

        arg_13 = arg_8.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_7 is True: arg_14 = ARMPolling(arg_13, **arg_8)
        elif arg_7 is False: arg_14 = NoPolling()
        else: arg_14 = arg_7
        return LROPoller(arg_0._client, arg_9, get_long_running_output, arg_14)


def Func(arg_0):
    """Handle connection and service errors.

    Called internally when an event has failed to send so we
    can parse the error to determine whether we should attempt
    to retry sending the event again.
    Returns the action to take according to error type.

    :param error: The error received in the send attempt.
    :type error: Exception
    :rtype: ~uamqp.errors.ErrorAction
    """
    if arg_0.condition == b'com.microsoft:server-busy':
        return errors.ErrorAction(retry=True, backoff=4)
    if arg_0.condition == b'com.microsoft:timeout':
        return errors.ErrorAction(retry=True, backoff=2)
    if arg_0.condition == b'com.microsoft:operation-cancelled':
        return errors.ErrorAction(retry=True)
    if arg_0.condition == b"com.microsoft:container-close":
        return errors.ErrorAction(retry=True, backoff=4)
    if arg_0.condition in _NO_RETRY_ERRORS:
        return errors.ErrorAction(retry=False)
    return errors.ErrorAction(retry=True)


def Func(arg_0, arg_1, arg_2=False):
        '''
        Deletes an existing queue. This operation will also remove all
        associated state including messages in the queue.

        queue_name:
            Name of the queue to delete.
        fail_not_exist:
            Specify whether to throw an exception if the queue doesn't exist.
        '''
        _validate_not_none('queue_name', arg_1)
        arg_3 = HTTPRequest()
        arg_3.method = 'DELETE'
        arg_3.host = arg_0._get_host()
        arg_3.path = '/' + _str(arg_1) + ''
        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)  # pylint: disable=protected-access
        arg_3.headers = arg_0._update_service_bus_header(arg_3)
        if not arg_2:
            try:
                arg_0._perform_request(arg_3)
                return True
            except AzureHttpError as ex:
                _dont_fail_not_exist(ex)
                return False
        else:
            arg_0._perform_request(arg_3)
            return True


def Func(arg_0, arg_1):
        '''
        Retrieves an existing queue.

        queue_name:
            Name of the queue.
        '''
        _validate_not_none('queue_name', arg_1)
        arg_2 = HTTPRequest()
        arg_2.method = 'GET'
        arg_2.host = arg_0._get_host()
        arg_2.path = '/' + _str(arg_1) + ''
        arg_2.path, arg_2.query = arg_0._httpclient._update_request_uri_query(arg_2)  # pylint: disable=protected-access
        arg_2.headers = arg_0._update_service_bus_header(arg_2)
        arg_8 = arg_0._perform_request(arg_2)

        return _convert_response_to_queue(arg_8)


def Func(arg_0, arg_1, arg_2=None, arg_3=False):
        '''
        Creates a new topic. Once created, this topic resource manifest is
        immutable.

        topic_name:
            Name of the topic to create.
        topic:
            Topic object to create.
        fail_on_exist:
            Specify whether to throw an exception when the topic exists.
        '''
        _validate_not_none('topic_name', arg_1)
        arg_4 = HTTPRequest()
        arg_4.method = 'PUT'
        arg_4.host = arg_0._get_host()
        arg_4.path = '/' + _str(arg_1) + ''
        arg_4.body = _get_request_body(_convert_topic_to_xml(arg_2))
        arg_4.path, arg_4.query = arg_0._httpclient._update_request_uri_query(arg_4)  # pylint: disable=protected-access
        arg_4.headers = arg_0._update_service_bus_header(arg_4)
        if not arg_3:
            try:
                arg_0._perform_request(arg_4)
                return True
            except AzureHttpError as ex:
                _dont_fail_on_exist(ex)
                return False
        else:
            arg_0._perform_request(arg_4)
            return True


def Func(arg_0, arg_1, arg_2, arg_3, arg_4=None,
                    arg_5=False):
        '''
        Creates a new rule. Once created, this rule's resource manifest is
        immutable.

        topic_name:
            Name of the topic.
        subscription_name:
            Name of the subscription.
        rule_name:
            Name of the rule.
        fail_on_exist:
            Specify whether to throw an exception when the rule exists.
        '''
        _validate_not_none('topic_name', arg_1)
        _validate_not_none('subscription_name', arg_2)
        _validate_not_none('rule_name', arg_3)
        arg_6 = HTTPRequest()
        arg_6.method = 'PUT'
        arg_6.host = arg_0._get_host()
        arg_6.path = '/' + _str(arg_1) + '/subscriptions/' + \
            _str(arg_2) + \
            '/rules/' + _str(arg_3) + ''
        arg_6.body = _get_request_body(_convert_rule_to_xml(arg_4))
        arg_6.path, arg_6.query = arg_0._httpclient._update_request_uri_query(arg_6)  # pylint: disable=protected-access
        arg_6.headers = arg_0._update_service_bus_header(arg_6)
        if not arg_5:
            try:
                arg_0._perform_request(arg_6)
                return True
            except AzureHttpError as ex:
                _dont_fail_on_exist(ex)
                return False
        else:
            arg_0._perform_request(arg_6)
            return True


def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        Retrieves the description for the specified rule.

        topic_name:
            Name of the topic.
        subscription_name:
            Name of the subscription.
        rule_name:
            Name of the rule.
        '''
        _validate_not_none('topic_name', arg_1)
        _validate_not_none('subscription_name', arg_2)
        _validate_not_none('rule_name', arg_3)
        arg_4 = HTTPRequest()
        arg_4.method = 'GET'
        arg_4.host = arg_0._get_host()
        arg_4.path = '/' + _str(arg_1) + '/subscriptions/' + \
            _str(arg_2) + \
            '/rules/' + _str(arg_3) + ''
        arg_4.path, arg_4.query = arg_0._httpclient._update_request_uri_query(arg_4)  # pylint: disable=protected-access
        arg_4.headers = arg_0._update_service_bus_header(arg_4)
        arg_10 = arg_0._perform_request(arg_4)

        return _convert_response_to_rule(arg_10)


def Func(arg_0, arg_1, arg_2):
        '''
        Retrieves the rules that exist under the specified subscription.

        topic_name:
            Name of the topic.
        subscription_name:
            Name of the subscription.
        '''
        _validate_not_none('topic_name', arg_1)
        _validate_not_none('subscription_name', arg_2)
        arg_3 = HTTPRequest()
        arg_3.method = 'GET'
        arg_3.host = arg_0._get_host()
        arg_3.path = '/' + \
            _str(arg_1) + '/subscriptions/' + \
            _str(arg_2) + '/rules/'
        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)  # pylint: disable=protected-access
        arg_3.headers = arg_0._update_service_bus_header(arg_3)
        arg_9 = arg_0._perform_request(arg_3)

        return _ETreeXmlToObject.convert_response_to_feeds(
            arg_9, _convert_etree_element_to_rule)


def Func(arg_0, arg_1, arg_2,
                            arg_3=None, arg_4=False):
        '''
        Creates a new subscription. Once created, this subscription resource
        manifest is immutable.

        topic_name:
            Name of the topic.
        subscription_name:
            Name of the subscription.
        fail_on_exist:
            Specify whether throw exception when subscription exists.
        '''
        _validate_not_none('topic_name', arg_1)
        _validate_not_none('subscription_name', arg_2)
        arg_5 = HTTPRequest()
        arg_5.method = 'PUT'
        arg_5.host = arg_0._get_host()
        arg_5.path = '/' + \
            _str(arg_1) + '/subscriptions/' + _str(arg_2) + ''
        arg_5.body = _get_request_body(
            _convert_subscription_to_xml(arg_3))
        arg_5.path, arg_5.query = arg_0._httpclient._update_request_uri_query(arg_5)  # pylint: disable=protected-access
        arg_5.headers = arg_0._update_service_bus_header(arg_5)
        if not arg_4:
            try:
                arg_0._perform_request(arg_5)
                return True
            except AzureHttpError as ex:
                _dont_fail_on_exist(ex)
                return False
        else:
            arg_0._perform_request(arg_5)
            return True


def Func(arg_0, arg_1, arg_2):
        '''
        Gets an existing subscription.

        topic_name:
            Name of the topic.
        subscription_name:
            Name of the subscription.
        '''
        _validate_not_none('topic_name', arg_1)
        _validate_not_none('subscription_name', arg_2)
        arg_3 = HTTPRequest()
        arg_3.method = 'GET'
        arg_3.host = arg_0._get_host()
        arg_3.path = '/' + \
            _str(arg_1) + '/subscriptions/' + _str(arg_2) + ''
        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)  # pylint: disable=protected-access
        arg_3.headers = arg_0._update_service_bus_header(arg_3)
        arg_9 = arg_0._perform_request(arg_3)

        return _convert_response_to_subscription(arg_9)


def Func(arg_0, arg_1, arg_2=None):
        '''
        Enqueues a message into the specified topic. The limit to the number
        of messages which may be present in the topic is governed by the
        message size in MaxTopicSizeInBytes. If this message causes the topic
        to exceed its quota, a quota exceeded error is returned and the
        message will be rejected.

        topic_name:
            Name of the topic.
        message:
            Message object containing message body and properties.
        '''
        _validate_not_none('topic_name', arg_1)
        _validate_not_none('message', arg_2)
        arg_3 = HTTPRequest()
        arg_3.method = 'POST'
        arg_3.host = arg_0._get_host()
        arg_3.path = '/' + _str(arg_1) + '/messages'
        arg_3.headers = arg_2.add_headers(arg_3)
        arg_3.body = _get_request_body(arg_2.body)
        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)  # pylint: disable=protected-access
        arg_3.headers = arg_0._update_service_bus_header(arg_3)
        arg_0._perform_request(arg_3)


def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        Unlocks a message for processing by other receivers on a given
        queue. This operation deletes the lock object, causing the
        message to be unlocked. A message must have first been locked by a
        receiver before this operation is called.

        queue_name:
            Name of the queue.
        sequence_number:
            The sequence number of the message to be unlocked as returned in
            BrokerProperties['SequenceNumber'] by the Peek Message operation.
        lock_token:
            The ID of the lock as returned by the Peek Message operation in
            BrokerProperties['LockToken']
        '''
        _validate_not_none('queue_name', arg_1)
        _validate_not_none('sequence_number', arg_2)
        _validate_not_none('lock_token', arg_3)
        arg_4 = HTTPRequest()
        arg_4.method = 'PUT'
        arg_4.host = arg_0._get_host()
        arg_4.path = '/' + _str(arg_1) + \
                       '/messages/' + _str(arg_2) + \
                       '/' + _str(arg_3) + ''
        arg_4.path, arg_4.query = arg_0._httpclient._update_request_uri_query(arg_4)  # pylint: disable=protected-access
        arg_4.headers = arg_0._update_service_bus_header(arg_4)
        arg_0._perform_request(arg_4)


def Func(arg_0, arg_1, arg_2=True, arg_3=60):
        '''
        Receive a message from a queue for processing.

        queue_name:
            Name of the queue.
        peek_lock:
            Optional. True to retrieve and lock the message. False to read and
            delete the message. Default is True (lock).
        timeout:
            Optional. The timeout parameter is expressed in seconds.
        '''
        if arg_2:
            return arg_0.peek_lock_queue_message(arg_1, arg_3)
        return arg_0.read_delete_queue_message(arg_1, arg_3)


def Func(arg_0, arg_1, arg_2,
                                     arg_3=True, arg_4=60):
        '''
        Receive a message from a subscription for processing.

        topic_name:
            Name of the topic.
        subscription_name:
            Name of the subscription.
        peek_lock:
            Optional. True to retrieve and lock the message. False to read and
            delete the message. Default is True (lock).
        timeout:
            Optional. The timeout parameter is expressed in seconds.
        '''
        if arg_3:
            return arg_0.peek_lock_subscription_message(arg_1,
                                                       arg_2,
                                                       arg_4)
        return arg_0.read_delete_subscription_message(arg_1,
                                                     arg_2,
                                                     arg_4)


def Func(arg_0, arg_1, arg_2=None, arg_3=False):
        '''
        Creates a new Event Hub.

        hub_name:
            Name of event hub.
        hub:
            Optional. Event hub properties. Instance of EventHub class.
        hub.message_retention_in_days:
            Number of days to retain the events for this Event Hub.
        hub.status:
            Status of the Event Hub (enabled or disabled).
        hub.user_metadata:
            User metadata.
        hub.partition_count:
            Number of shards on the Event Hub.
        fail_on_exist:
            Specify whether to throw an exception when the event hub exists.
        '''
        _validate_not_none('hub_name', arg_1)
        arg_4 = HTTPRequest()
        arg_4.method = 'PUT'
        arg_4.host = arg_0._get_host()
        arg_4.path = '/' + _str(arg_1) + '?api-version=2014-01'
        arg_4.body = _get_request_body(_convert_event_hub_to_xml(arg_2))
        arg_4.path, arg_4.query = arg_0._httpclient._update_request_uri_query(arg_4)  # pylint: disable=protected-access
        arg_4.headers = arg_0._update_service_bus_header(arg_4)
        if not arg_3:
            try:
                arg_0._perform_request(arg_4)
                return True
            except AzureHttpError as ex:
                _dont_fail_on_exist(ex)
                return False
        else:
            arg_0._perform_request(arg_4)
            return True


def Func(arg_0, arg_1):
        '''
        Retrieves an existing event hub.

        hub_name:
            Name of the event hub.
        '''
        _validate_not_none('hub_name', arg_1)
        arg_2 = HTTPRequest()
        arg_2.method = 'GET'
        arg_2.host = arg_0._get_host()
        arg_2.path = '/' + _str(arg_1) + ''
        arg_2.path, arg_2.query = arg_0._httpclient._update_request_uri_query(arg_2)  # pylint: disable=protected-access
        arg_2.headers = arg_0._update_service_bus_header(arg_2)
        arg_8 = arg_0._perform_request(arg_2)

        return _convert_response_to_event_hub(arg_8)


def Func(arg_0, arg_1):
        ''' Add additional headers for Service Bus. '''

        if arg_1.method in ['PUT', 'POST', 'MERGE', 'DELETE']:
            arg_1.headers.append(('Content-Length', str(len(arg_1.body))))

        # if it is not GET or HEAD request, must set content-type.
        if not arg_1.method in ['GET', 'HEAD']:
            for arg_2, arg_3 in arg_1.headers:
                if arg_2.lower() == 'content-type':
                    break
            else:
                arg_1.headers.append(
                    ('Content-Type',
                     'application/atom+xml;type=entry;charset=utf-8'))

        # Adds authorization header for authentication.
        arg_0.authentication.sign_request(arg_1, arg_0._httpclient)

        return arg_1.headers


def Func(arg_0, arg_1):  # pylint: disable=no-self-use
        ''' Check if token expires or not. '''
        arg_2 = arg_1.find('ExpiresOn=') + len('ExpiresOn=')
        arg_3 = arg_1.find('&', arg_2)
        arg_4 = int(arg_1[arg_2:arg_3])
        arg_5 = time.mktime(time.localtime())

        # Adding 30 seconds so the token wouldn't be expired when we send the
        # token to server.
        return (arg_4 - arg_5) < 30


def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=False, arg_7=True, **arg_8):
        """Reset Service Principal Profile of a managed cluster.

        Update the service principal Profile for a managed cluster.

        :param resource_group_name: The name of the resource group.
        :type resource_group_name: str
        :param resource_name: The name of the managed cluster resource.
        :type resource_name: str
        :param client_id: The ID for the service principal.
        :type client_id: str
        :param secret: The secret password associated with the service
         principal in plain text.
        :type secret: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns None or
         ClientRawResponse<None> if raw==True
        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
        """
        arg_9 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=True,
            **arg_8
        )

        def get_long_running_output(arg_10):
            if arg_6:
                arg_11 = ClientRawResponse(None, arg_10)
                return arg_11

        arg_12 = arg_8.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_7 is True: arg_13 = ARMPolling(arg_12, **arg_8)
        elif arg_7 is False: arg_13 = NoPolling()
        else: arg_13 = arg_7
        return LROPoller(arg_0._client, arg_9, get_long_running_output, arg_13)


def Func(arg_0):
        ''' Deletes itself if find queue name or topic name and subscription
        name. '''
        if arg_0._queue_name:
            arg_0.service_bus_service.Func_queue_message(
                arg_0._queue_name,
                arg_0.broker_properties['SequenceNumber'],
                arg_0.broker_properties['LockToken'])
        elif arg_0._topic_name and arg_0._subscription_name:
            arg_0.service_bus_service.Func_subscription_message(
                arg_0._topic_name,
                arg_0._subscription_name,
                arg_0.broker_properties['SequenceNumber'],
                arg_0.broker_properties['LockToken'])
        else:
            raise AzureServiceBusPeekLockError(_ERROR_MESSAGE_NOT_PEEK_LOCKED_ON_DELETE)


def Func(arg_0):
        ''' Unlocks itself if find queue name or topic name and subscription
        name. '''
        if arg_0._queue_name:
            arg_0.service_bus_service.Func_queue_message(
                arg_0._queue_name,
                arg_0.broker_properties['SequenceNumber'],
                arg_0.broker_properties['LockToken'])
        elif arg_0._topic_name and arg_0._subscription_name:
            arg_0.service_bus_service.Func_subscription_message(
                arg_0._topic_name,
                arg_0._subscription_name,
                arg_0.broker_properties['SequenceNumber'],
                arg_0.broker_properties['LockToken'])
        else:
            raise AzureServiceBusPeekLockError(_ERROR_MESSAGE_NOT_PEEK_LOCKED_ON_UNLOCK)


def Func(arg_0):
        ''' Renew lock on itself if find queue name or topic name and subscription
        name. '''
        if arg_0._queue_name:
            arg_0.service_bus_service.Func_queue_message(
                arg_0._queue_name,
                arg_0.broker_properties['SequenceNumber'],
                arg_0.broker_properties['LockToken'])
        elif arg_0._topic_name and arg_0._subscription_name:
            arg_0.service_bus_service.Func_subscription_message(
                arg_0._topic_name,
                arg_0._subscription_name,
                arg_0.broker_properties['SequenceNumber'],
                arg_0.broker_properties['LockToken'])
        else:
            raise AzureServiceBusPeekLockError(_ERROR_MESSAGE_NOT_PEEK_LOCKED_ON_RENEW_LOCK)


def Func(arg_0, arg_1):
        ''' add addtional headers to request for message request.'''

        # Adds custom properties
        if arg_0.custom_properties:
            for arg_2, arg_3 in arg_0.custom_properties.items():
                arg_1.headers.append((arg_2, arg_0._serialize_escaped_properties_value(arg_3)))

        # Adds content-type
        arg_1.headers.append(('Content-Type', arg_0.type))

        # Adds BrokerProperties
        if arg_0.broker_properties:
            if hasattr(arg_0.broker_properties, 'items'):
                arg_4 = {arg_2: arg_0._serialize_basic_properties_value(arg_3)
                                     for arg_2, arg_3
                                     in arg_0.broker_properties.items()}
                arg_4 = json.dumps(arg_4)
            else:
                arg_4 = arg_0.broker_properties
            arg_1.headers.append(
                ('BrokerProperties', str(arg_4)))

        return arg_1.headers


def Func(arg_0):
        ''' return the current message as expected by batch body format'''
        if sys.version_info >= (3,) and isinstance(arg_0.body, bytes):
            # It HAS to be string to be serialized in JSON
            arg_1 = arg_0.body.decode('utf-8')
        else:
            # Python 2.7 people handle this themself
            arg_1 = arg_0.body
        arg_2 = {'Body': arg_1}

        # Adds custom properties
        if arg_0.custom_properties:
            arg_2['UserProperties'] = {name: arg_0._serialize_basic_properties_value(value)
                                        for name, value
                                        in arg_0.custom_properties.items()}

        # Adds BrokerProperties
        if arg_0.broker_properties:
            arg_2['BrokerProperties'] = {name: arg_0._serialize_basic_properties_value(value)
                                          for name, value
                                          in arg_0.broker_properties.items()}

        return arg_2


def Func(
            arg_0, arg_1=0, arg_2=0, arg_3=0, arg_4=False, arg_5=False, arg_6=60, arg_7=None, arg_8=False, **arg_9):
        """Gets the health of a Service Fabric cluster.

        Use EventsHealthStateFilter to filter the collection of health events
        reported on the cluster based on the health state.
        Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter
        to filter the collection of nodes and applications returned based on
        their aggregated health state.

        :param nodes_health_state_filter: Allows filtering of the node health
         state objects returned in the result of cluster health query
         based on their health state. The possible values for this parameter
         include integer value of one of the
         following health states. Only nodes that match the filter are
         returned. All nodes are used to evaluate the aggregated health state.
         If not specified, all entries are returned.
         The state values are flag-based enumeration, so the value could be a
         combination of these values obtained using bitwise 'OR' operator.
         For example, if the provided value is 6 then health state of nodes
         with HealthState value of OK (2) and Warning (4) are returned.
         - Default - Default value. Matches any HealthState. The value is zero.
         - None - Filter that doesn't match any HealthState value. Used in
         order to return no results on a given collection of states. The value
         is 1.
         - Ok - Filter that matches input with HealthState value Ok. The value
         is 2.
         - Warning - Filter that matches input with HealthState value Warning.
         The value is 4.
         - Error - Filter that matches input with HealthState value Error. The
         value is 8.
         - All - Filter that matches input with any HealthState value. The
         value is 65535.
        :type nodes_health_state_filter: int
        :param applications_health_state_filter: Allows filtering of the
         application health state objects returned in the result of cluster
         health
         query based on their health state.
         The possible values for this parameter include integer value obtained
         from members or bitwise operations
         on members of HealthStateFilter enumeration. Only applications that
         match the filter are returned.
         All applications are used to evaluate the aggregated health state. If
         not specified, all entries are returned.
         The state values are flag-based enumeration, so the value could be a
         combination of these values obtained using bitwise 'OR' operator.
         For example, if the provided value is 6 then health state of
         applications with HealthState value of OK (2) and Warning (4) are
         returned.
         - Default - Default value. Matches any HealthState. The value is zero.
         - None - Filter that doesn't match any HealthState value. Used in
         order to return no results on a given collection of states. The value
         is 1.
         - Ok - Filter that matches input with HealthState value Ok. The value
         is 2.
         - Warning - Filter that matches input with HealthState value Warning.
         The value is 4.
         - Error - Filter that matches input with HealthState value Error. The
         value is 8.
         - All - Filter that matches input with any HealthState value. The
         value is 65535.
        :type applications_health_state_filter: int
        :param events_health_state_filter: Allows filtering the collection of
         HealthEvent objects returned based on health state.
         The possible values for this parameter include integer value of one of
         the following health states.
         Only events that match the filter are returned. All events are used to
         evaluate the aggregated health state.
         If not specified, all entries are returned. The state values are
         flag-based enumeration, so the value could be a combination of these
         values, obtained using the bitwise 'OR' operator. For example, If the
         provided value is 6 then all of the events with HealthState value of
         OK (2) and Warning (4) are returned.
         - Default - Default value. Matches any HealthState. The value is zero.
         - None - Filter that doesn't match any HealthState value. Used in
         order to return no results on a given collection of states. The value
         is 1.
         - Ok - Filter that matches input with HealthState value Ok. The value
         is 2.
         - Warning - Filter that matches input with HealthState value Warning.
         The value is 4.
         - Error - Filter that matches input with HealthState value Error. The
         value is 8.
         - All - Filter that matches input with any HealthState value. The
         value is 65535.
        :type events_health_state_filter: int
        :param exclude_health_statistics: Indicates whether the health
         statistics should be returned as part of the query result. False by
         default.
         The statistics show the number of children entities in health state
         Ok, Warning, and Error.
        :type exclude_health_statistics: bool
        :param include_system_application_health_statistics: Indicates whether
         the health statistics should include the fabric:/System application
         health statistics. False by default.
         If IncludeSystemApplicationHealthStatistics is set to true, the health
         statistics include the entities that belong to the fabric:/System
         application.
         Otherwise, the query result includes health statistics only for user
         applications.
         The health statistics must be included in the query result for this
         parameter to be applied.
        :type include_system_application_health_statistics: bool
        :param timeout: The server timeout for performing the operation in
         seconds. This timeout specifies the time duration that the client is
         willing to wait for the requested operation to complete. The default
         value for this parameter is 60 seconds.
        :type timeout: long
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: ClusterHealth or ClientRawResponse if raw=true
        :rtype: ~azure.servicefabric.models.ClusterHealth or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`
        """
        arg_10 = "6.0"

        # Construct URL
        arg_11 = arg_0.Func.metadata['url']

        # Construct parameters
        arg_12 = {}
        arg_12['api-version'] = arg_0._serialize.query("api_version", arg_10, 'str')
        if arg_1 is not None:
            arg_12['NodesHealthStateFilter'] = arg_0._serialize.query("nodes_health_state_filter", arg_1, 'int')
        if arg_2 is not None:
            arg_12['ApplicationsHealthStateFilter'] = arg_0._serialize.query("applications_health_state_filter", arg_2, 'int')
        if arg_3 is not None:
            arg_12['EventsHealthStateFilter'] = arg_0._serialize.query("events_health_state_filter", arg_3, 'int')
        if arg_4 is not None:
            arg_12['ExcludeHealthStatistics'] = arg_0._serialize.query("exclude_health_statistics", arg_4, 'bool')
        if arg_5 is not None:
            arg_12['IncludeSystemApplicationHealthStatistics'] = arg_0._serialize.query("include_system_application_health_statistics", arg_5, 'bool')
        if arg_6 is not None:
            arg_12['timeout'] = arg_0._serialize.query("timeout", arg_6, 'long', maximum=4294967295, minimum=1)

        # Construct headers
        arg_13 = {}
        arg_13['Accept'] = 'application/json'
        if arg_7:
            arg_13.update(arg_7)

        # Construct and send request
        arg_14 = arg_0._client.get(arg_11, arg_12, arg_13)
        arg_15 = arg_0._client.send(arg_14, stream=False, **arg_9)

        if arg_15.status_code not in [200]:
            raise models.FabricErrorException(arg_0._deserialize, arg_15)

        arg_16 = None

        if arg_15.status_code == 200:
            arg_16 = arg_0._deserialize('ClusterHealth', arg_15)

        if arg_8:
            arg_17 = ClientRawResponse(arg_16, arg_15)
            return arg_17

        return arg_16


def Func(
            arg_0, arg_1=0, arg_2=0, arg_3=0, arg_4=False, arg_5=False, arg_6=60, arg_7=None, arg_8=None, arg_9=None, arg_10=False, **arg_11):
        """Gets the health of a Service Fabric cluster using the specified policy.

        Use EventsHealthStateFilter to filter the collection of health events
        reported on the cluster based on the health state.
        Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter
        to filter the collection of nodes and applications returned based on
        their aggregated health state.
        Use ClusterHealthPolicies to override the health policies used to
        evaluate the health.

        :param nodes_health_state_filter: Allows filtering of the node health
         state objects returned in the result of cluster health query
         based on their health state. The possible values for this parameter
         include integer value of one of the
         following health states. Only nodes that match the filter are
         returned. All nodes are used to evaluate the aggregated health state.
         If not specified, all entries are returned.
         The state values are flag-based enumeration, so the value could be a
         combination of these values obtained using bitwise 'OR' operator.
         For example, if the provided value is 6 then health state of nodes
         with HealthState value of OK (2) and Warning (4) are returned.
         - Default - Default value. Matches any HealthState. The value is zero.
         - None - Filter that doesn't match any HealthState value. Used in
         order to return no results on a given collection of states. The value
         is 1.
         - Ok - Filter that matches input with HealthState value Ok. The value
         is 2.
         - Warning - Filter that matches input with HealthState value Warning.
         The value is 4.
         - Error - Filter that matches input with HealthState value Error. The
         value is 8.
         - All - Filter that matches input with any HealthState value. The
         value is 65535.
        :type nodes_health_state_filter: int
        :param applications_health_state_filter: Allows filtering of the
         application health state objects returned in the result of cluster
         health
         query based on their health state.
         The possible values for this parameter include integer value obtained
         from members or bitwise operations
         on members of HealthStateFilter enumeration. Only applications that
         match the filter are returned.
         All applications are used to evaluate the aggregated health state. If
         not specified, all entries are returned.
         The state values are flag-based enumeration, so the value could be a
         combination of these values obtained using bitwise 'OR' operator.
         For example, if the provided value is 6 then health state of
         applications with HealthState value of OK (2) and Warning (4) are
         returned.
         - Default - Default value. Matches any HealthState. The value is zero.
         - None - Filter that doesn't match any HealthState value. Used in
         order to return no results on a given collection of states. The value
         is 1.
         - Ok - Filter that matches input with HealthState value Ok. The value
         is 2.
         - Warning - Filter that matches input with HealthState value Warning.
         The value is 4.
         - Error - Filter that matches input with HealthState value Error. The
         value is 8.
         - All - Filter that matches input with any HealthState value. The
         value is 65535.
        :type applications_health_state_filter: int
        :param events_health_state_filter: Allows filtering the collection of
         HealthEvent objects returned based on health state.
         The possible values for this parameter include integer value of one of
         the following health states.
         Only events that match the filter are returned. All events are used to
         evaluate the aggregated health state.
         If not specified, all entries are returned. The state values are
         flag-based enumeration, so the value could be a combination of these
         values, obtained using the bitwise 'OR' operator. For example, If the
         provided value is 6 then all of the events with HealthState value of
         OK (2) and Warning (4) are returned.
         - Default - Default value. Matches any HealthState. The value is zero.
         - None - Filter that doesn't match any HealthState value. Used in
         order to return no results on a given collection of states. The value
         is 1.
         - Ok - Filter that matches input with HealthState value Ok. The value
         is 2.
         - Warning - Filter that matches input with HealthState value Warning.
         The value is 4.
         - Error - Filter that matches input with HealthState value Error. The
         value is 8.
         - All - Filter that matches input with any HealthState value. The
         value is 65535.
        :type events_health_state_filter: int
        :param exclude_health_statistics: Indicates whether the health
         statistics should be returned as part of the query result. False by
         default.
         The statistics show the number of children entities in health state
         Ok, Warning, and Error.
        :type exclude_health_statistics: bool
        :param include_system_application_health_statistics: Indicates whether
         the health statistics should include the fabric:/System application
         health statistics. False by default.
         If IncludeSystemApplicationHealthStatistics is set to true, the health
         statistics include the entities that belong to the fabric:/System
         application.
         Otherwise, the query result includes health statistics only for user
         applications.
         The health statistics must be included in the query result for this
         parameter to be applied.
        :type include_system_application_health_statistics: bool
        :param timeout: The server timeout for performing the operation in
         seconds. This timeout specifies the time duration that the client is
         willing to wait for the requested operation to complete. The default
         value for this parameter is 60 seconds.
        :type timeout: long
        :param application_health_policy_map: Defines a map that contains
         specific application health policies for different applications.
         Each entry specifies as key the application name and as value an
         ApplicationHealthPolicy used to evaluate the application health.
         If an application is not specified in the map, the application health
         evaluation uses the ApplicationHealthPolicy found in its application
         manifest or the default application health policy (if no health policy
         is defined in the manifest).
         The map is empty by default.
        :type application_health_policy_map:
         list[~azure.servicefabric.models.ApplicationHealthPolicyMapItem]
        :param cluster_health_policy: Defines a health policy used to evaluate
         the health of the cluster or of a cluster node.
        :type cluster_health_policy:
         ~azure.servicefabric.models.ClusterHealthPolicy
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: ClusterHealth or ClientRawResponse if raw=true
        :rtype: ~azure.servicefabric.models.ClusterHealth or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`
        """
        arg_12 = None
        if arg_7 is not None or arg_8 is not None:
            arg_12 = models.ClusterHealthPolicies(arg_7=arg_7, arg_8=arg_8)

        arg_13 = "6.0"

        # Construct URL
        arg_14 = arg_0.Func.metadata['url']

        # Construct parameters
        arg_15 = {}
        arg_15['api-version'] = arg_0._serialize.query("api_version", arg_13, 'str')
        if arg_1 is not None:
            arg_15['NodesHealthStateFilter'] = arg_0._serialize.query("nodes_health_state_filter", arg_1, 'int')
        if arg_2 is not None:
            arg_15['ApplicationsHealthStateFilter'] = arg_0._serialize.query("applications_health_state_filter", arg_2, 'int')
        if arg_3 is not None:
            arg_15['EventsHealthStateFilter'] = arg_0._serialize.query("events_health_state_filter", arg_3, 'int')
        if arg_4 is not None:
            arg_15['ExcludeHealthStatistics'] = arg_0._serialize.query("exclude_health_statistics", arg_4, 'bool')
        if arg_5 is not None:
            arg_15['IncludeSystemApplicationHealthStatistics'] = arg_0._serialize.query("include_system_application_health_statistics", arg_5, 'bool')
        if arg_6 is not None:
            arg_15['timeout'] = arg_0._serialize.query("timeout", arg_6, 'long', maximum=4294967295, minimum=1)

        # Construct headers
        arg_16 = {}
        arg_16['Accept'] = 'application/json'
        arg_16['Content-Type'] = 'application/json; charset=utf-8'
        if arg_9:
            arg_16.update(arg_9)

        # Construct body
        if arg_12 is not None:
            arg_17 = arg_0._serialize.body(arg_12, 'ClusterHealthPolicies')
        else:
            arg_17 = None

        # Construct and send request
        arg_18 = arg_0._client.post(arg_14, arg_15, arg_16, arg_17)
        arg_19 = arg_0._client.send(arg_18, stream=False, **arg_11)

        if arg_19.status_code not in [200]:
            raise models.FabricErrorException(arg_0._deserialize, arg_19)

        arg_20 = None

        if arg_19.status_code == 200:
            arg_20 = arg_0._deserialize('ClusterHealth', arg_19)

        if arg_10:
            arg_21 = ClientRawResponse(arg_20, arg_19)
            return arg_21

        return arg_20


def Func(
            arg_0, arg_1, arg_2, arg_3=60, arg_4=None, arg_5=None, arg_6=False, **arg_7):
        """Removes or unregisters a Service Fabric application type from the
        cluster.

        This operation can only be performed if all application instances of
        the application type have been deleted. Once the application type is
        unregistered, no new application instances can be created for this
        particular application type.

        :param application_type_name: The name of the application type.
        :type application_type_name: str
        :param application_type_version: The version of the application type
         as defined in the application manifest.
        :type application_type_version: str
        :param timeout: The server timeout for performing the operation in
         seconds. This timeout specifies the time duration that the client is
         willing to wait for the requested operation to complete. The default
         value for this parameter is 60 seconds.
        :type timeout: long
        :param async_parameter: The flag indicating whether or not unprovision
         should occur asynchronously. When set to true, the unprovision
         operation returns when the request is accepted by the system, and the
         unprovision operation continues without any timeout limit. The default
         value is false. However, we recommend setting it to true for large
         application packages that were provisioned.
        :type async_parameter: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`
        """
        arg_8 = models.UnprovisionApplicationTypeDescriptionInfo(arg_2=arg_2, async_property=arg_4)

        arg_9 = "6.0"

        # Construct URL
        arg_10 = arg_0.Func.metadata['url']
        arg_11 = {
            'applicationTypeName': arg_0._serialize.url("application_type_name", arg_1, 'str')
        }
        arg_10 = arg_0._client.format_url(arg_10, **arg_11)

        # Construct parameters
        arg_12 = {}
        arg_12['api-version'] = arg_0._serialize.query("api_version", arg_9, 'str')
        if arg_3 is not None:
            arg_12['timeout'] = arg_0._serialize.query("timeout", arg_3, 'long', maximum=4294967295, minimum=1)

        # Construct headers
        arg_13 = {}
        arg_13['Content-Type'] = 'application/json; charset=utf-8'
        if arg_5:
            arg_13.update(arg_5)

        # Construct body
        arg_14 = arg_0._serialize.body(arg_8, 'UnprovisionApplicationTypeDescriptionInfo')

        # Construct and send request
        arg_15 = arg_0._client.post(arg_10, arg_12, arg_13, arg_14)
        arg_16 = arg_0._client.send(arg_15, stream=False, **arg_7)

        if arg_16.status_code not in [200, 202]:
            raise models.FabricErrorException(arg_0._deserialize, arg_16)

        if arg_6:
            arg_17 = ClientRawResponse(None, arg_16)
            return arg_17


def Func(
            arg_0, arg_1, arg_2=60, arg_3=None, arg_4=None, arg_5=False, **arg_6):
        """Submits a property batch.

        Submits a batch of property operations. Either all or none of the
        operations will be committed.

        :param name_id: The Service Fabric name, without the 'fabric:' URI
         scheme.
        :type name_id: str
        :param timeout: The server timeout for performing the operation in
         seconds. This timeout specifies the time duration that the client is
         willing to wait for the requested operation to complete. The default
         value for this parameter is 60 seconds.
        :type timeout: long
        :param operations: A list of the property batch operations to be
         executed.
        :type operations:
         list[~azure.servicefabric.models.PropertyBatchOperation]
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: PropertyBatchInfo or ClientRawResponse if raw=true
        :rtype: ~azure.servicefabric.models.PropertyBatchInfo or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`
        """
        arg_7 = models.PropertyBatchDescriptionList(arg_3=arg_3)

        arg_8 = "6.0"

        # Construct URL
        arg_9 = arg_0.Func.metadata['url']
        arg_10 = {
            'nameId': arg_0._serialize.url("name_id", arg_1, 'str', skip_quote=True)
        }
        arg_9 = arg_0._client.format_url(arg_9, **arg_10)

        # Construct parameters
        arg_11 = {}
        arg_11['api-version'] = arg_0._serialize.query("api_version", arg_8, 'str')
        if arg_2 is not None:
            arg_11['timeout'] = arg_0._serialize.query("timeout", arg_2, 'long', maximum=4294967295, minimum=1)

        # Construct headers
        arg_12 = {}
        arg_12['Accept'] = 'application/json'
        arg_12['Content-Type'] = 'application/json; charset=utf-8'
        if arg_4:
            arg_12.update(arg_4)

        # Construct body
        arg_13 = arg_0._serialize.body(arg_7, 'PropertyBatchDescriptionList')

        # Construct and send request
        arg_14 = arg_0._client.post(arg_9, arg_11, arg_12, arg_13)
        arg_15 = arg_0._client.send(arg_14, stream=False, **arg_6)

        if arg_15.status_code not in [200, 409]:
            raise models.FabricErrorException(arg_0._deserialize, arg_15)

        arg_16 = None

        if arg_15.status_code == 200:
            arg_16 = arg_0._deserialize('SuccessfulPropertyBatchInfo', arg_15)
        if arg_15.status_code == 409:
            arg_16 = arg_0._deserialize('FailedPropertyBatchInfo', arg_15)

        if arg_5:
            arg_17 = ClientRawResponse(arg_16, arg_15)
            return arg_17

        return arg_16


def Func(
            arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=None, arg_7=False, arg_8=True, **arg_9):
        """Start capturing network packets for the site.

        Start capturing network packets for the site.

        :param resource_group_name: Name of the resource group to which the
         resource belongs.
        :type resource_group_name: str
        :param name: The name of the web app.
        :type name: str
        :param duration_in_seconds: The duration to keep capturing in seconds.
        :type duration_in_seconds: int
        :param max_frame_length: The maximum frame length in bytes (Optional).
        :type max_frame_length: int
        :param sas_url: The Blob URL to store capture file.
        :type sas_url: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns list or
         ClientRawResponse<list> if raw==True
        :rtype:
         ~msrestazure.azure_operation.AzureOperationPoller[list[~azure.mgmt.web.models.NetworkTrace]]
         or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[list[~azure.mgmt.web.models.NetworkTrace]]]
        :raises:
         :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
        """
        arg_10 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6,
            arg_7=True,
            **arg_9
        )

        def get_long_running_output(arg_11):
            arg_12 = arg_0._deserialize('[NetworkTrace]', arg_11)

            if arg_7:
                arg_13 = ClientRawResponse(arg_12, arg_11)
                return arg_13

            return arg_12

        arg_14 = arg_9.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_8 is True: arg_15 = ARMPolling(arg_14, **arg_9)
        elif arg_8 is False: arg_15 = NoPolling()
        else: arg_15 = arg_8
        return LROPoller(arg_0._client, arg_10, get_long_running_output, arg_15)


def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6=None, arg_7=False, **arg_8):
        """Get the difference in configuration settings between two web app slots.

        Get the difference in configuration settings between two web app slots.

        :param resource_group_name: Name of the resource group to which the
         resource belongs.
        :type resource_group_name: str
        :param name: Name of the app.
        :type name: str
        :param slot: Name of the source slot. If a slot is not specified, the
         production slot is used as the source slot.
        :type slot: str
        :param target_slot: Destination deployment slot during swap operation.
        :type target_slot: str
        :param preserve_vnet: true to preserve Virtual Network to
         the slot during swap; otherwise, false.
        :type preserve_vnet: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: An iterator like instance of SlotDifference
        :rtype:
         ~azure.mgmt.web.models.SlotDifferencePaged[~azure.mgmt.web.models.SlotDifference]
        :raises:
         :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
        """
        arg_9 = models.CsmSlotEntity(arg_4=arg_4, arg_5=arg_5)

        def internal_paging(arg_10=None, arg_7=False):

            if not arg_10:
                # Construct URL
                arg_11 = arg_0.Func.metadata['url']
                arg_12 = {
                    'resourceGroupName': arg_0._serialize.url("resource_group_name", arg_1, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                    'name': arg_0._serialize.url("name", arg_2, 'str'),
                    'slot': arg_0._serialize.url("slot", arg_3, 'str'),
                    'subscriptionId': arg_0._serialize.url("self.config.subscription_id", arg_0.config.subscription_id, 'str')
                }
                arg_11 = arg_0._client.format_url(arg_11, **arg_12)

                # Construct parameters
                arg_13 = {}
                arg_13['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')

            else:
                arg_11 = arg_10
                arg_13 = {}

            # Construct headers
            arg_14 = {}
            arg_14['Accept'] = 'application/json'
            arg_14['Content-Type'] = 'application/json; charset=utf-8'
            if arg_0.config.generate_client_request_id:
                arg_14['x-ms-client-request-id'] = str(uuid.uuid1())
            if arg_6:
                arg_14.update(arg_6)
            if arg_0.config.accept_language is not None:
                arg_14['accept-language'] = arg_0._serialize.header("self.config.accept_language", arg_0.config.accept_language, 'str')

            # Construct body
            arg_15 = arg_0._serialize.body(arg_9, 'CsmSlotEntity')

            # Construct and send request
            arg_16 = arg_0._client.post(arg_11, arg_13, arg_14, arg_15)
            arg_17 = arg_0._client.send(arg_16, stream=False, **arg_8)

            if arg_17.status_code not in [200]:
                raise models.DefaultErrorResponseException(arg_0._deserialize, arg_17)

            return arg_17

        # Deserialize response
        arg_18 = models.SlotDifferencePaged(internal_paging, arg_0._deserialize.dependencies)

        if arg_7:
            arg_19 = {}
            arg_20 = models.SlotDifferencePaged(internal_paging, arg_0._deserialize.dependencies, arg_19)
            return arg_20

        return arg_18


def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6=None, arg_7=False, arg_8=True, **arg_9):
        """Swaps two deployment slots of an app.

        Swaps two deployment slots of an app.

        :param resource_group_name: Name of the resource group to which the
         resource belongs.
        :type resource_group_name: str
        :param name: Name of the app.
        :type name: str
        :param slot: Name of the source slot. If a slot is not specified, the
         production slot is used as the source slot.
        :type slot: str
        :param target_slot: Destination deployment slot during swap operation.
        :type target_slot: str
        :param preserve_vnet: true to preserve Virtual Network to
         the slot during swap; otherwise, false.
        :type preserve_vnet: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns None or
         ClientRawResponse<None> if raw==True
        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
        """
        arg_10 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6,
            arg_7=True,
            **arg_9
        )

        def get_long_running_output(arg_11):
            if arg_7:
                arg_12 = ClientRawResponse(None, arg_11)
                return arg_12

        arg_13 = arg_9.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_8 is True: arg_14 = ARMPolling(arg_13, **arg_9)
        elif arg_8 is False: arg_14 = NoPolling()
        else: arg_14 = arg_8
        return LROPoller(arg_0._client, arg_10, get_long_running_output, arg_14)


def Func(
            arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=None, arg_7=None, arg_8=None, arg_9=None, arg_10=None, arg_11=None, arg_12=None, arg_13=None, arg_14=False, **arg_15):
        """Execute OData query.

        Executes an OData query for events.

        :param app_id: ID of the application. This is Application ID from the
         API Access settings blade in the Azure portal.
        :type app_id: str
        :param event_type: The type of events to query; either a standard
         event type (`traces`, `customEvents`, `pageViews`, `requests`,
         `dependencies`, `exceptions`, `availabilityResults`) or `$all` to
         query across all event types. Possible values include: '$all',
         'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests',
         'dependencies', 'exceptions', 'availabilityResults',
         'performanceCounters', 'customMetrics'
        :type event_type: str or ~azure.applicationinsights.models.EventType
        :param timespan: Optional. The timespan over which to retrieve events.
         This is an ISO8601 time period value.  This timespan is applied in
         addition to any that are specified in the Odata expression.
        :type timespan: str
        :param filter: An expression used to filter the returned events
        :type filter: str
        :param search: A free-text search expression to match for whether a
         particular event should be returned
        :type search: str
        :param orderby: A comma-separated list of properties with \\"asc\\"
         (the default) or \\"desc\\" to control the order of returned events
        :type orderby: str
        :param select: Limits the properties to just those requested on each
         returned event
        :type select: str
        :param skip: The number of items to skip over before returning events
        :type skip: int
        :param top: The number of events to return
        :type top: int
        :param format: Format for the returned events
        :type format: str
        :param count: Request a count of matching items included with the
         returned events
        :type count: bool
        :param apply: An expression used for aggregation over returned events
        :type apply: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: EventsResults or ClientRawResponse if raw=true
        :rtype: ~azure.applicationinsights.models.EventsResults or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ErrorResponseException<azure.applicationinsights.models.ErrorResponseException>`
        """
        # Construct URL
        arg_16 = arg_0.Func.metadata['url']
        arg_17 = {
            'appId': arg_0._serialize.url("app_id", arg_1, 'str'),
            'eventType': arg_0._serialize.url("event_type", arg_2, 'str')
        }
        arg_16 = arg_0._client.format_url(arg_16, **arg_17)

        # Construct parameters
        arg_18 = {}
        if arg_3 is not None:
            arg_18['timespan'] = arg_0._serialize.query("timespan", arg_3, 'str')
        if arg_4 is not None:
            arg_18['$filter'] = arg_0._serialize.query("filter", arg_4, 'str')
        if arg_5 is not None:
            arg_18['$search'] = arg_0._serialize.query("search", arg_5, 'str')
        if arg_6 is not None:
            arg_18['$orderby'] = arg_0._serialize.query("orderby", arg_6, 'str')
        if arg_7 is not None:
            arg_18['$select'] = arg_0._serialize.query("select", arg_7, 'str')
        if arg_8 is not None:
            arg_18['$skip'] = arg_0._serialize.query("skip", arg_8, 'int')
        if arg_9 is not None:
            arg_18['$top'] = arg_0._serialize.query("top", arg_9, 'int')
        if arg_10 is not None:
            arg_18['$format'] = arg_0._serialize.query("format", arg_10, 'str')
        if arg_11 is not None:
            arg_18['$count'] = arg_0._serialize.query("count", arg_11, 'bool')
        if arg_12 is not None:
            arg_18['$apply'] = arg_0._serialize.query("apply", arg_12, 'str')

        # Construct headers
        arg_19 = {}
        arg_19['Accept'] = 'application/json'
        if arg_13:
            arg_19.update(arg_13)

        # Construct and send request
        arg_20 = arg_0._client.get(arg_16, arg_18, arg_19)
        arg_21 = arg_0._client.send(arg_20, stream=False, **arg_15)

        if arg_21.status_code not in [200]:
            raise models.ErrorResponseException(arg_0._deserialize, arg_21)

        arg_22 = None

        if arg_21.status_code == 200:
            arg_22 = arg_0._deserialize('EventsResults', arg_21)

        if arg_14:
            arg_23 = ClientRawResponse(arg_22, arg_21)
            return arg_23

        return arg_22


def Func(
            arg_0, arg_1, arg_2, arg_3=None, arg_4=None, arg_5=None, arg_6=False, arg_7=None, **arg_8):
        """Add a face to a large face list. The input face is specified as an
        image with a targetFace rectangle. It returns a persistedFaceId
        representing the added face, and persistedFaceId will not expire.

        :param large_face_list_id: Id referencing a particular large face
         list.
        :type large_face_list_id: str
        :param image: An image stream.
        :type image: Generator
        :param user_data: User-specified data about the face for any purpose.
         The maximum length is 1KB.
        :type user_data: str
        :param target_face: A face rectangle to specify the target face to be
         added to a person in the format of "targetFace=left,top,width,height".
         E.g. "targetFace=10,10,100,100". If there is more than one face in the
         image, targetFace is required to specify which face to add. No
         targetFace means there is only one face detected in the entire image.
        :type target_face: list[int]
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param callback: When specified, will be called with each chunk of
         data that is streamed. The callback should take two arguments, the
         bytes of the current chunk of data and the response object. If the
         data is uploading, response will be None.
        :type callback: Callable[Bytes, response=None]
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: PersistedFace or ClientRawResponse if raw=true
        :rtype: ~azure.cognitiveservices.vision.face.models.PersistedFace or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`
        """
        # Construct URL
        arg_9 = arg_0.Func.metadata['url']
        arg_10 = {
            'Endpoint': arg_0._serialize.url("self.config.endpoint", arg_0.config.endpoint, 'str', skip_quote=True),
            'largeFaceListId': arg_0._serialize.url("large_face_list_id", arg_1, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$')
        }
        arg_9 = arg_0._client.format_url(arg_9, **arg_10)

        # Construct parameters
        arg_11 = {}
        if arg_3 is not None:
            arg_11['userData'] = arg_0._serialize.query("user_data", arg_3, 'str', max_length=1024)
        if arg_4 is not None:
            arg_11['targetFace'] = arg_0._serialize.query("target_face", arg_4, '[int]', div=',')

        # Construct headers
        arg_12 = {}
        arg_12['Accept'] = 'application/json'
        arg_12['Content-Type'] = 'application/octet-stream'
        if arg_5:
            arg_12.update(arg_5)

        # Construct body
        arg_13 = arg_0._client.stream_upload(arg_2, arg_7)

        # Construct and send request
        arg_14 = arg_0._client.post(arg_9, arg_11, arg_12, arg_13)
        arg_15 = arg_0._client.send(arg_14, stream=False, **arg_8)

        if arg_15.status_code not in [200]:
            raise models.APIErrorException(arg_0._deserialize, arg_15)

        arg_16 = None

        if arg_15.status_code == 200:
            arg_16 = arg_0._deserialize('PersistedFace', arg_15)

        if arg_6:
            arg_17 = ClientRawResponse(arg_16, arg_15)
            return arg_17

        return arg_16


def Func(arg_0, arg_1, **arg_2):
        """Reset auth_attempted on redirects."""
        if arg_1.is_redirect:
            arg_0._thread_local.auth_attempted = False


def Func(
            arg_0, arg_1, arg_2, arg_3=None, arg_4=False, **arg_5):
        """Publishes a batch of events to an Azure Event Grid topic.

        :param topic_hostname: The host name of the topic, e.g.
         topic1.westus2-1.eventgrid.azure.net
        :type topic_hostname: str
        :param events: An array of events to be published to Event Grid.
        :type events: list[~azure.eventgrid.models.EventGridEvent]
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
        """
        # Construct URL
        arg_6 = arg_0.Func.metadata['url']
        arg_7 = {
            'topicHostname': arg_0._serialize.url("topic_hostname", arg_1, 'str', skip_quote=True)
        }
        arg_6 = arg_0._client.format_url(arg_6, **arg_7)

        # Construct parameters
        arg_8 = {}
        arg_8['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')

        # Construct headers
        arg_9 = {}
        arg_9['Content-Type'] = 'application/json; charset=utf-8'
        if arg_3:
            arg_9.update(arg_3)

        # Construct body
        arg_10 = arg_0._serialize.body(arg_2, '[EventGridEvent]')

        # Construct and send request
        arg_11 = arg_0._client.post(arg_6, arg_8)
        arg_12 = arg_0._client.send(
            arg_11, arg_9, arg_10, stream=False, **arg_5)

        if arg_12.status_code not in [200]:
            raise HttpOperationError(arg_0._deserialize, arg_12)

        if arg_4:
            arg_13 = ClientRawResponse(None, arg_12)
            return arg_13


def Func(
            arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=False, arg_6=True, **arg_7):
        """Moves resources from one resource group to another resource group.

        The resources to move must be in the same source resource group. The
        target resource group may be in a different subscription. When moving
        resources, both the source group and the target group are locked for
        the duration of the operation. Write and delete operations are blocked
        on the groups until the move completes. .

        :param source_resource_group_name: The name of the resource group
         containing the resources to move.
        :type source_resource_group_name: str
        :param resources: The IDs of the resources.
        :type resources: list[str]
        :param target_resource_group: The target resource group.
        :type target_resource_group: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns None or
         ClientRawResponse<None> if raw==True
        :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
        """
        arg_8 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=True,
            **arg_7
        )

        def get_long_running_output(arg_9):
            if arg_5:
                arg_10 = ClientRawResponse(None, arg_9)
                return arg_10

        arg_11 = arg_7.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_6 is True: arg_12 = ARMPolling(arg_11, **arg_7)
        elif arg_6 is False: arg_12 = NoPolling()
        else: arg_12 = arg_6
        return LROPoller(arg_0._client, arg_8, get_long_running_output, arg_12)


def Func(
            arg_0, arg_1,
            arg_2=30, arg_3=None,
            arg_4=False,
            arg_5=False,
            arg_6=None,
            arg_7=False,
            arg_8=None,
            arg_9=None, arg_10=None):
        """Create a queue entity.

        :param queue_name: The name of the new queue.
        :type queue_name: str
        :param lock_duration: The lock durection in seconds for each message in the queue.
        :type lock_duration: int
        :param max_size_in_megabytes: The max size to allow the queue to grow to.
        :type max_size_in_megabytes: int
        :param requires_duplicate_detection: Whether the queue will require every message with
         a specified time frame to have a unique ID. Non-unique messages will be discarded.
         Default value is False.
        :type requires_duplicate_detection: bool
        :param requires_session: Whether the queue will be sessionful, and therefore require all
         message to have a Session ID and be received by a sessionful receiver.
         Default value is False.
        :type requires_session: bool
        :param default_message_time_to_live: The length of time a message will remain in the queue
         before it is either discarded or moved to the dead letter queue.
        :type default_message_time_to_live: ~datetime.timedelta
        :param dead_lettering_on_message_expiration: Whether to move expired messages to the
         dead letter queue. Default value is False.
        :type dead_lettering_on_message_expiration: bool
        :param duplicate_detection_history_time_window: The period within which all incoming messages
         must have a unique message ID.
        :type duplicate_detection_history_time_window: ~datetime.timedelta
        :param max_delivery_count: The maximum number of times a message will attempt to be delivered
         before it is moved to the dead letter queue.
        :type max_delivery_count: int
        :param enable_batched_operations:
        :type: enable_batched_operations: bool
        :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found.
        :raises: ~azure.common.AzureConflictHttpError if a queue of the same name already exists.
        """
        arg_11 = Queue(
            arg_2="PT{}S".format(int(arg_2)),
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6,
            arg_7=arg_7,
            arg_8=arg_8,
            arg_9=arg_9,
            arg_10=arg_10)
        try:
            return arg_0.mgmt_client.Func(arg_1, queue=arg_11, fail_on_exist=True)
        except requests.exceptions.ConnectionError as e:
            raise ServiceBusConnectionError("Namespace: {} not found".format(arg_0.service_namespace), e)


def Func(arg_0, arg_1, arg_2=False):
        """Delete a queue entity.

        :param queue_name: The name of the queue to delete.
        :type queue_name: str
        :param fail_not_exist: Whether to raise an exception if the named queue is not
         found. If set to True, a ServiceBusResourceNotFound will be raised.
         Default value is False.
        :type fail_not_exist: bool
        :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namesapce is not found.
        :raises: ~azure.servicebus.common.errors.ServiceBusResourceNotFound if the queue is not found
         and `fail_not_exist` is set to True.
        """
        try:
            return arg_0.mgmt_client.Func(arg_1, arg_2=arg_2)
        except requests.exceptions.ConnectionError as e:
            raise ServiceBusConnectionError("Namespace: {} not found".format(arg_0.service_namespace), e)
        except azure.common.AzureMissingResourceHttpError as e:
            raise ServiceBusResourceNotFound("Specificed queue '{}' does not exist.".format(arg_1), e)


def Func(arg_0, arg_1, arg_2=False):
        """Delete a topic entity.

        :param topic_name: The name of the topic to delete.
        :type topic_name: str
        :param fail_not_exist: Whether to raise an exception if the named topic is not
         found. If set to True, a ServiceBusResourceNotFound will be raised.
         Default value is False.
        :type fail_not_exist: bool
        :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namesapce is not found.
        :raises: ~azure.servicebus.common.errors.ServiceBusResourceNotFound if the topic is not found
         and `fail_not_exist` is set to True.
        """
        try:
            return arg_0.mgmt_client.Func(arg_1, arg_2=arg_2)
        except requests.exceptions.ConnectionError as e:
            raise ServiceBusConnectionError("Namespace: {} not found".format(arg_0.service_namespace), e)
        except azure.common.AzureMissingResourceHttpError as e:
            raise ServiceBusResourceNotFound("Specificed queue does not exist.", e)


def Func(
            arg_0, arg_1, arg_2,
            arg_3=30, arg_4=None,
            arg_5=None,
            arg_6=None,
            arg_7=None,
            arg_8=None, arg_9=None):
        """Create a subscription entity.

        :param topic_name: The name of the topic under which to create the subscription.
        :param subscription_name: The name of the new subscription.
        :type subscription_name: str
        :param lock_duration: The lock durection in seconds for each message in the subscription.
        :type lock_duration: int
        :param requires_session: Whether the subscription will be sessionful, and therefore require all
         message to have a Session ID and be received by a sessionful receiver.
         Default value is False.
        :type requires_session: bool
        :param default_message_time_to_live: The length of time a message will remain in the subscription
         before it is either discarded or moved to the dead letter queue.
        :type default_message_time_to_live: ~datetime.timedelta
        :param dead_lettering_on_message_expiration: Whether to move expired messages to the
         dead letter queue. Default value is False.
        :type dead_lettering_on_message_expiration: bool
        :param dead_lettering_on_filter_evaluation_exceptions: Whether to move messages that error on
         filtering into the dead letter queue. Default is False, and the messages will be discarded.
        :type dead_lettering_on_filter_evaluation_exceptions: bool
        :param max_delivery_count: The maximum number of times a message will attempt to be delivered
         before it is moved to the dead letter queue.
        :type max_delivery_count: int
        :param enable_batched_operations:
        :type: enable_batched_operations: bool
        :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the namespace is not found.
        :raises: ~azure.common.AzureConflictHttpError if a queue of the same name already exists.
        """
        arg_10 = Subscription(
            arg_3="PT{}S".format(int(arg_3)),
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6,
            arg_7=arg_7,
            arg_9=arg_9,
            arg_8=arg_8)
        try:
            return arg_0.mgmt_client.Func(
                arg_1, arg_2,
                subscription=arg_10, fail_on_exist=True)
        except requests.exceptions.ConnectionError as e:
            raise ServiceBusConnectionError("Namespace: {} not found".format(arg_0.service_namespace), e)


def Func(arg_0):
        """Perform an operation to update the properties of the entity.

        :returns: The properties of the entity as a dictionary.
        :rtype: dict[str, Any]
        :raises: ~azure.servicebus.common.errors.ServiceBusResourceNotFound if the entity does not exist.
        :raises: ~azure.servicebus.common.errors.ServiceBusConnectionError if the endpoint cannot be reached.
        :raises: ~azure.common.AzureHTTPError if the credentials are invalid.
        """
        try:
            arg_0.entity = arg_0._get_entity()
            arg_0.properties = dict(arg_0.entity)
            if hasattr(arg_0.entity, 'requires_session'):
                arg_0.requires_session = arg_0.entity.requires_session
            return arg_0.properties
        except AzureServiceBusResourceNotFound:
            raise ServiceBusResourceNotFound("Specificed queue does not exist.")
        except azure.common.AzureHttpError:
            arg_0.entity = None
            arg_0.properties = {}
            arg_0.requires_session = False
        except requests.exceptions.ConnectionError as e:
            raise ServiceBusConnectionError("Namespace not found", e)


def Func(arg_0):
        """Whether the receivers lock on a particular session has Func.

        :rtype: bool
        """
        if arg_0.locked_until and arg_0.locked_until <= datetime.datetime.now():
            return True
        return False


def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=False, arg_6=True, **arg_7):
        """Creates an Azure subscription.

        :param billing_account_name: The name of the commerce root billing
         account.
        :type billing_account_name: str
        :param invoice_section_name: The name of the invoice section.
        :type invoice_section_name: str
        :param body: The subscription creation parameters.
        :type body:
         ~azure.mgmt.subscription.models.SubscriptionCreationParameters
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns
         SubscriptionCreationResult or
         ClientRawResponse<SubscriptionCreationResult> if raw==True
        :rtype:
         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.subscription.models.SubscriptionCreationResult]
         or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.subscription.models.SubscriptionCreationResult]]
        :raises:
         :class:`ErrorResponseException<azure.mgmt.subscription.models.ErrorResponseException>`
        """
        arg_8 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=True,
            **arg_7
        )

        def get_long_running_output(arg_9):
            arg_10 = {
                'Location': 'str',
                'Retry-After': 'int',
            }
            arg_11 = arg_0._deserialize('SubscriptionCreationResult', arg_9)

            if arg_5:
                arg_12 = ClientRawResponse(arg_11, arg_9)
                arg_12.add_headers(arg_10)
                return arg_12

            return arg_11

        arg_13 = arg_7.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_6 is True: arg_14 = ARMPolling(arg_13, **arg_7)
        elif arg_6 is False: arg_14 = NoPolling()
        else: arg_14 = arg_6
        return LROPoller(arg_0._client, arg_8, get_long_running_output, arg_14)


def Func(
            arg_0, arg_1, arg_2, arg_3=None, arg_4=False, arg_5=True, **arg_6):
        """Export logs that show Api requests made by this subscription in the
        given time window to show throttling activities.

        :param parameters: Parameters supplied to the LogAnalytics
         getRequestRateByInterval Api.
        :type parameters:
         ~azure.mgmt.compute.v2018_04_01.models.RequestRateByIntervalInput
        :param location: The location upon which virtual-machine-sizes is
         queried.
        :type location: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: The poller return type is ClientRawResponse, the
         direct response alongside the deserialized response
        :param polling: True for ARMPolling, False for no polling, or a
         polling object for personal polling strategy
        :return: An instance of LROPoller that returns
         LogAnalyticsOperationResult or
         ClientRawResponse<LogAnalyticsOperationResult> if raw==True
        :rtype:
         ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult]
         or
         ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult]]
        :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
        """
        arg_7 = arg_0._Func_initial(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=True,
            **arg_6
        )

        def get_long_running_output(arg_8):
            arg_9 = arg_0._deserialize('LogAnalyticsOperationResult', arg_8)

            if arg_4:
                arg_10 = ClientRawResponse(arg_9, arg_8)
                return arg_10

            return arg_9

        arg_11 = arg_6.get(
            'long_running_operation_timeout',
            arg_0.config.long_running_operation_timeout)
        if arg_5 is True: arg_12 = ARMPolling(arg_11, lro_options={'final-state-via': 'azure-async-operation'}, **arg_6)
        elif arg_5 is False: arg_12 = NoPolling()
        else: arg_12 = arg_5
        return LROPoller(arg_0._client, arg_7, get_long_running_output, arg_12)


def Func(arg_0):
    """Scan output for exceptions

    If there is an output from an add task collection call add it to the results.

    :param results_queue: Queue containing results of attempted add_collection's
    :type results_queue: collections.deque
    :return: list of TaskAddResults
    :rtype: list[~TaskAddResult]
    """
    arg_1 = []
    while arg_0:
        arg_2 = arg_0.pop()
        arg_1.append(arg_2)
    return arg_1


def Func(arg_0, arg_1):
        """Main method for worker to run

        Pops a chunk of tasks off the collection of pending tasks to be added and submits them to be added.

        :param collections.deque results_queue: Queue for worker to output results to
        """
        # Add tasks until either we run out or we run into an unexpected error
        while arg_0.tasks_to_add and not arg_0.errors:
            arg_2 = arg_0._max_tasks_per_request  # local copy
            arg_3 = []
            with arg_0._pending_queue_lock:
                while len(arg_3) < arg_2 and arg_0.tasks_to_add:
                    arg_3.append(arg_0.tasks_to_add.pop())

            if arg_3:
                arg_0._bulk_add_tasks(arg_1, arg_3)