We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Dreamhost integration will break November 2nd, 2021
It looks like Dreamhost is "retiring" some of it's API calls Nov 2nd, including `domain-list_domains` which Lexicon seems to use for validating the domain during initial auth:

https://help.dreamhost.com/hc/en-us/articles/217555767-Domain-API-commands

https://github.com/AnalogJ/lexicon/blob/db82a948febee04972bb648ac59471b292c7e394/lexicon/providers/dreamhost.py#L103

They have begin sending email to anyone using the API:

> The following API commands were run on your account in the last thirty days and will no longer function after November 2nd:
> - domain-list_domains

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lexicon/providers/dreamhost.py`
Content:
```
1 """Module provider for Dreamhost"""
2 import base64
3 import json
4 import logging
5 import time
6 
7 import requests
8 
9 from lexicon.exceptions import AuthenticationError
10 from lexicon.providers.base import Provider as BaseProvider
11 
12 LOGGER = logging.getLogger(__name__)
13 
14 NAMESERVER_DOMAINS = ["dreamhost.com"]
15 
16 _DATA_NON_EXIST_ERROR_LIST = [
17     "no_record",
18     "no_type",
19     "no_value",
20     "no_such_record",
21     "no_such_type",
22     "no_such_value",
23     "no_such_zone",
24 ]
25 
26 _DATA_ALREADY_EXIST_ERROR_LIST = [
27     "record_already_exists_not_editable",
28     "record_already_exists_remove_first",
29     "CNAME_already_on_record",
30 ]
31 
32 
33 class NonExistError(Exception):
34     """NonExistError"""
35 
36 
37 class AlreadyExistError(Exception):
38     """AlreadyExistError"""
39 
40 
41 def provider_parser(subparser):
42     """Module provider for Dreamhost"""
43     subparser.add_argument("--auth-token", help="specify api key for authentication")
44 
45 
46 class Provider(BaseProvider):
47     """Provider class for Dreamhost"""
48 
49     def __init__(self, config):
50         super(Provider, self).__init__(config)
51         self.domain_id = None
52         self.api_endpoint = "https://api.dreamhost.com/"
53 
54     # Dreamhost provides no identifier for a record.
55     # Furthermore, Dreamhost requires type, record, value to delete a record.
56     # The record defined in lexicon is {type, name, content, id}
57     # We use base64(json({'type', 'name', 'content'}))
58     # as the identifier of Dreamhost record.
59     @staticmethod
60     def _identifier(dreamhost_record):
61         id_struct = {
62             "type": dreamhost_record["type"],
63             "name": dreamhost_record["record"],
64             "content": dreamhost_record["value"],
65         }
66         return base64.urlsafe_b64encode(json.dumps(id_struct).encode("utf-8")).decode(
67             "utf-8"
68         )
69 
70     # The information in identifier follows the record in lexicon.
71     # Provider._record_to_dreamhost_record transfers to dreamhost-based record.
72     @staticmethod
73     def _id_to_dreamhost_record(identifier):
74         record = json.loads(
75             base64.urlsafe_b64decode(identifier.encode("utf-8")).decode("utf-8")
76         )
77         dreamhost_record = Provider._record_to_dreamhost_record(record)
78         return dreamhost_record
79 
80     # The information in identifier follows the record in lexicon.
81     # 'id' is added in the record.
82     @staticmethod
83     def _id_to_record(identifier):
84         record = json.loads(
85             base64.urlsafe_b64decode(identifier.encode("utf-8")).decode("utf-8")
86         )
87         record["id"] = identifier
88 
89         return record
90 
91     # Transferring lexicon-based record to Dreamhost-based record.
92     @staticmethod
93     def _record_to_dreamhost_record(record):
94         dreamhost_record = {
95             "type": record["type"],
96             "record": record["name"],
97             "value": record["content"],
98         }
99         return dreamhost_record
100 
101     def _authenticate(self):
102         self.domain_id = None
103         payload = self._get("domain-list_domains")
104         data = payload.get("data", None)
105         if data is None:
106             raise AuthenticationError("Domain not found")
107 
108         for domain in data:
109             if domain.get("domain", "") == self.domain:
110                 self.domain_id = self.domain
111         if self.domain_id is None:
112             raise AuthenticationError("Domain not found")
113 
114     def _create_record(self, rtype, name, content):
115         name = self._full_name(name)
116 
117         try:
118             self._get(
119                 "dns-add_record",
120                 query_params={"record": name, "type": rtype, "value": content},
121             )
122         except AlreadyExistError:
123             pass
124 
125         return True
126 
127     # List all records. Return an empty list if no records found
128     # type, name and content are used to filter records.
129     # If possible filter during the query, otherwise filter after response is received.
130     def _list_records(self, rtype=None, name=None, content=None):
131 
132         payload = self._get("dns-list_records")
133 
134         resource_list = payload.get("data", None)
135         if not isinstance(resource_list, list):
136             raise Exception(f"unable to get records: {payload}")
137 
138         resource_list = [
139             resource for resource in resource_list if resource["zone"] == self.domain
140         ]
141         if rtype:
142             resource_list = [
143                 resource for resource in resource_list if resource["type"] == rtype
144             ]
145         if name:
146             name = self._full_name(name)
147             resource_list = [
148                 resource for resource in resource_list if resource["record"] == name
149             ]
150         if content:
151             resource_list = [
152                 resource for resource in resource_list if resource["value"] == content
153             ]
154 
155         processed_records = []
156         for dreamhost_record in resource_list:
157             processed_records.append(
158                 {
159                     "id": Provider._identifier(dreamhost_record),
160                     "type": dreamhost_record["type"],
161                     "name": dreamhost_record["record"],
162                     "content": dreamhost_record["value"],
163                 }
164             )
165 
166         return processed_records
167 
168     # Create or update a record.
169     def _update_record(self, identifier, rtype=None, name=None, content=None):
170         if identifier:
171             try:
172                 self._delete_record(identifier)
173             except NonExistError:
174                 pass
175 
176         return self._create_record(rtype=rtype, name=name, content=content)
177 
178     # Delete existing records.
179     # If record does not exist, do nothing.
180     def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
181         to_deletes = []
182         if identifier:
183             record = Provider._id_to_record(identifier)
184             to_deletes.append(record)
185         else:
186             records = self._list_records(rtype=rtype, name=name, content=content)
187             to_deletes = records
188 
189         # for-loop to delete deletes.
190         err = None
191         for each in to_deletes:
192             try:
193                 dreamhost_record = Provider._record_to_dreamhost_record(each)
194                 self._get("dns-remove_record", query_params=dreamhost_record)
195 
196             except Exception as exception:
197                 err = exception
198 
199             # Sleeping for 1-second to avoid trigerring ddos protecting in case of looped requests
200             time.sleep(1)
201 
202         if err is not None:
203             raise err
204 
205         return True
206 
207     # Helpers
208     def _request(self, action="GET", url="", data=None, query_params=None):
209         if data is None:
210             data = {}
211 
212         if query_params is None:
213             query_params = {}
214 
215         default_headers = {
216             "Accept": "application/json",
217             "Content-Type": "application/json",
218         }
219 
220         query_params["key"] = self._get_provider_option("auth_token")
221         query_params["format"] = "json"
222         if "cmd" not in query_params:
223             query_params["cmd"] = url
224 
225         response = requests.request(
226             action,
227             self.api_endpoint,
228             params=query_params,
229             data=json.dumps(data),
230             headers=default_headers,
231         )
232 
233         # if the request fails for any reason, throw an error.
234         response.raise_for_status()
235         result = response.json()
236         if result.get("result", "") != "success":
237             err_msg = result.get("data", "")
238             if err_msg in _DATA_NON_EXIST_ERROR_LIST:
239                 raise NonExistError(f"Dreamhost non-exist error: {result}")
240             if err_msg in _DATA_ALREADY_EXIST_ERROR_LIST:
241                 raise AlreadyExistError(f"Dreamhost already-exist error: {result}")
242             raise Exception(f"Dreamhost api error: {result}")
243         return result
244
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lexicon/providers/dreamhost.py b/lexicon/providers/dreamhost.py
--- a/lexicon/providers/dreamhost.py
+++ b/lexicon/providers/dreamhost.py
@@ -100,14 +100,15 @@
 
     def _authenticate(self):
         self.domain_id = None
-        payload = self._get("domain-list_domains")
+        payload = self._get("dns-list_records")
         data = payload.get("data", None)
         if data is None:
             raise AuthenticationError("Domain not found")
 
-        for domain in data:
-            if domain.get("domain", "") == self.domain:
+        for record in data:
+            if record.get("record", "") == self.domain and record.get("type", "") in ["A", "AAAA"]:
                 self.domain_id = self.domain
+                break
         if self.domain_id is None:
             raise AuthenticationError("Domain not found")

{"golden_diff": "diff --git a/lexicon/providers/dreamhost.py b/lexicon/providers/dreamhost.py\n--- a/lexicon/providers/dreamhost.py\n+++ b/lexicon/providers/dreamhost.py\n@@ -100,14 +100,15 @@\n \n     def _authenticate(self):\n         self.domain_id = None\n-        payload = self._get(\"domain-list_domains\")\n+        payload = self._get(\"dns-list_records\")\n         data = payload.get(\"data\", None)\n         if data is None:\n             raise AuthenticationError(\"Domain not found\")\n \n-        for domain in data:\n-            if domain.get(\"domain\", \"\") == self.domain:\n+        for record in data:\n+            if record.get(\"record\", \"\") == self.domain and record.get(\"type\", \"\") in [\"A\", \"AAAA\"]:\n                 self.domain_id = self.domain\n+                break\n         if self.domain_id is None:\n             raise AuthenticationError(\"Domain not found\")\n", "issue": "Dreamhost integration will break November 2nd, 2021\nIt looks like Dreamhost is \"retiring\" some of it's API calls Nov 2nd, including `domain-list_domains` which Lexicon seems to use for validating the domain during initial auth:\r\n\r\nhttps://help.dreamhost.com/hc/en-us/articles/217555767-Domain-API-commands\r\n\r\nhttps://github.com/AnalogJ/lexicon/blob/db82a948febee04972bb648ac59471b292c7e394/lexicon/providers/dreamhost.py#L103\r\n\r\nThey have begin sending email to anyone using the API:\r\n\r\n> The following API commands were run on your account in the last thirty days and will no longer function after November 2nd:\r\n> - domain-list_domains\n", "before_files": [{"content": "\"\"\"Module provider for Dreamhost\"\"\"\nimport base64\nimport json\nimport logging\nimport time\n\nimport requests\n\nfrom lexicon.exceptions import AuthenticationError\nfrom lexicon.providers.base import Provider as BaseProvider\n\nLOGGER = logging.getLogger(__name__)\n\nNAMESERVER_DOMAINS = [\"dreamhost.com\"]\n\n_DATA_NON_EXIST_ERROR_LIST = [\n    \"no_record\",\n    \"no_type\",\n    \"no_value\",\n    \"no_such_record\",\n    \"no_such_type\",\n    \"no_such_value\",\n    \"no_such_zone\",\n]\n\n_DATA_ALREADY_EXIST_ERROR_LIST = [\n    \"record_already_exists_not_editable\",\n    \"record_already_exists_remove_first\",\n    \"CNAME_already_on_record\",\n]\n\n\nclass NonExistError(Exception):\n    \"\"\"NonExistError\"\"\"\n\n\nclass AlreadyExistError(Exception):\n    \"\"\"AlreadyExistError\"\"\"\n\n\ndef provider_parser(subparser):\n    \"\"\"Module provider for Dreamhost\"\"\"\n    subparser.add_argument(\"--auth-token\", help=\"specify api key for authentication\")\n\n\nclass Provider(BaseProvider):\n    \"\"\"Provider class for Dreamhost\"\"\"\n\n    def __init__(self, config):\n        super(Provider, self).__init__(config)\n        self.domain_id = None\n        self.api_endpoint = \"https://api.dreamhost.com/\"\n\n    # Dreamhost provides no identifier for a record.\n    # Furthermore, Dreamhost requires type, record, value to delete a record.\n    # The record defined in lexicon is {type, name, content, id}\n    # We use base64(json({'type', 'name', 'content'}))\n    # as the identifier of Dreamhost record.\n    @staticmethod\n    def _identifier(dreamhost_record):\n        id_struct = {\n            \"type\": dreamhost_record[\"type\"],\n            \"name\": dreamhost_record[\"record\"],\n            \"content\": dreamhost_record[\"value\"],\n        }\n        return base64.urlsafe_b64encode(json.dumps(id_struct).encode(\"utf-8\")).decode(\n            \"utf-8\"\n        )\n\n    # The information in identifier follows the record in lexicon.\n    # Provider._record_to_dreamhost_record transfers to dreamhost-based record.\n    @staticmethod\n    def _id_to_dreamhost_record(identifier):\n        record = json.loads(\n            base64.urlsafe_b64decode(identifier.encode(\"utf-8\")).decode(\"utf-8\")\n        )\n        dreamhost_record = Provider._record_to_dreamhost_record(record)\n        return dreamhost_record\n\n    # The information in identifier follows the record in lexicon.\n    # 'id' is added in the record.\n    @staticmethod\n    def _id_to_record(identifier):\n        record = json.loads(\n            base64.urlsafe_b64decode(identifier.encode(\"utf-8\")).decode(\"utf-8\")\n        )\n        record[\"id\"] = identifier\n\n        return record\n\n    # Transferring lexicon-based record to Dreamhost-based record.\n    @staticmethod\n    def _record_to_dreamhost_record(record):\n        dreamhost_record = {\n            \"type\": record[\"type\"],\n            \"record\": record[\"name\"],\n            \"value\": record[\"content\"],\n        }\n        return dreamhost_record\n\n    def _authenticate(self):\n        self.domain_id = None\n        payload = self._get(\"domain-list_domains\")\n        data = payload.get(\"data\", None)\n        if data is None:\n            raise AuthenticationError(\"Domain not found\")\n\n        for domain in data:\n            if domain.get(\"domain\", \"\") == self.domain:\n                self.domain_id = self.domain\n        if self.domain_id is None:\n            raise AuthenticationError(\"Domain not found\")\n\n    def _create_record(self, rtype, name, content):\n        name = self._full_name(name)\n\n        try:\n            self._get(\n                \"dns-add_record\",\n                query_params={\"record\": name, \"type\": rtype, \"value\": content},\n            )\n        except AlreadyExistError:\n            pass\n\n        return True\n\n    # List all records. Return an empty list if no records found\n    # type, name and content are used to filter records.\n    # If possible filter during the query, otherwise filter after response is received.\n    def _list_records(self, rtype=None, name=None, content=None):\n\n        payload = self._get(\"dns-list_records\")\n\n        resource_list = payload.get(\"data\", None)\n        if not isinstance(resource_list, list):\n            raise Exception(f\"unable to get records: {payload}\")\n\n        resource_list = [\n            resource for resource in resource_list if resource[\"zone\"] == self.domain\n        ]\n        if rtype:\n            resource_list = [\n                resource for resource in resource_list if resource[\"type\"] == rtype\n            ]\n        if name:\n            name = self._full_name(name)\n            resource_list = [\n                resource for resource in resource_list if resource[\"record\"] == name\n            ]\n        if content:\n            resource_list = [\n                resource for resource in resource_list if resource[\"value\"] == content\n            ]\n\n        processed_records = []\n        for dreamhost_record in resource_list:\n            processed_records.append(\n                {\n                    \"id\": Provider._identifier(dreamhost_record),\n                    \"type\": dreamhost_record[\"type\"],\n                    \"name\": dreamhost_record[\"record\"],\n                    \"content\": dreamhost_record[\"value\"],\n                }\n            )\n\n        return processed_records\n\n    # Create or update a record.\n    def _update_record(self, identifier, rtype=None, name=None, content=None):\n        if identifier:\n            try:\n                self._delete_record(identifier)\n            except NonExistError:\n                pass\n\n        return self._create_record(rtype=rtype, name=name, content=content)\n\n    # Delete existing records.\n    # If record does not exist, do nothing.\n    def _delete_record(self, identifier=None, rtype=None, name=None, content=None):\n        to_deletes = []\n        if identifier:\n            record = Provider._id_to_record(identifier)\n            to_deletes.append(record)\n        else:\n            records = self._list_records(rtype=rtype, name=name, content=content)\n            to_deletes = records\n\n        # for-loop to delete deletes.\n        err = None\n        for each in to_deletes:\n            try:\n                dreamhost_record = Provider._record_to_dreamhost_record(each)\n                self._get(\"dns-remove_record\", query_params=dreamhost_record)\n\n            except Exception as exception:\n                err = exception\n\n            # Sleeping for 1-second to avoid trigerring ddos protecting in case of looped requests\n            time.sleep(1)\n\n        if err is not None:\n            raise err\n\n        return True\n\n    # Helpers\n    def _request(self, action=\"GET\", url=\"\", data=None, query_params=None):\n        if data is None:\n            data = {}\n\n        if query_params is None:\n            query_params = {}\n\n        default_headers = {\n            \"Accept\": \"application/json\",\n            \"Content-Type\": \"application/json\",\n        }\n\n        query_params[\"key\"] = self._get_provider_option(\"auth_token\")\n        query_params[\"format\"] = \"json\"\n        if \"cmd\" not in query_params:\n            query_params[\"cmd\"] = url\n\n        response = requests.request(\n            action,\n            self.api_endpoint,\n            params=query_params,\n            data=json.dumps(data),\n            headers=default_headers,\n        )\n\n        # if the request fails for any reason, throw an error.\n        response.raise_for_status()\n        result = response.json()\n        if result.get(\"result\", \"\") != \"success\":\n            err_msg = result.get(\"data\", \"\")\n            if err_msg in _DATA_NON_EXIST_ERROR_LIST:\n                raise NonExistError(f\"Dreamhost non-exist error: {result}\")\n            if err_msg in _DATA_ALREADY_EXIST_ERROR_LIST:\n                raise AlreadyExistError(f\"Dreamhost already-exist error: {result}\")\n            raise Exception(f\"Dreamhost api error: {result}\")\n        return result\n", "path": "lexicon/providers/dreamhost.py"}], "after_files": [{"content": "\"\"\"Module provider for Dreamhost\"\"\"\nimport base64\nimport json\nimport logging\nimport time\n\nimport requests\n\nfrom lexicon.exceptions import AuthenticationError\nfrom lexicon.providers.base import Provider as BaseProvider\n\nLOGGER = logging.getLogger(__name__)\n\nNAMESERVER_DOMAINS = [\"dreamhost.com\"]\n\n_DATA_NON_EXIST_ERROR_LIST = [\n    \"no_record\",\n    \"no_type\",\n    \"no_value\",\n    \"no_such_record\",\n    \"no_such_type\",\n    \"no_such_value\",\n    \"no_such_zone\",\n]\n\n_DATA_ALREADY_EXIST_ERROR_LIST = [\n    \"record_already_exists_not_editable\",\n    \"record_already_exists_remove_first\",\n    \"CNAME_already_on_record\",\n]\n\n\nclass NonExistError(Exception):\n    \"\"\"NonExistError\"\"\"\n\n\nclass AlreadyExistError(Exception):\n    \"\"\"AlreadyExistError\"\"\"\n\n\ndef provider_parser(subparser):\n    \"\"\"Module provider for Dreamhost\"\"\"\n    subparser.add_argument(\"--auth-token\", help=\"specify api key for authentication\")\n\n\nclass Provider(BaseProvider):\n    \"\"\"Provider class for Dreamhost\"\"\"\n\n    def __init__(self, config):\n        super(Provider, self).__init__(config)\n        self.domain_id = None\n        self.api_endpoint = \"https://api.dreamhost.com/\"\n\n    # Dreamhost provides no identifier for a record.\n    # Furthermore, Dreamhost requires type, record, value to delete a record.\n    # The record defined in lexicon is {type, name, content, id}\n    # We use base64(json({'type', 'name', 'content'}))\n    # as the identifier of Dreamhost record.\n    @staticmethod\n    def _identifier(dreamhost_record):\n        id_struct = {\n            \"type\": dreamhost_record[\"type\"],\n            \"name\": dreamhost_record[\"record\"],\n            \"content\": dreamhost_record[\"value\"],\n        }\n        return base64.urlsafe_b64encode(json.dumps(id_struct).encode(\"utf-8\")).decode(\n            \"utf-8\"\n        )\n\n    # The information in identifier follows the record in lexicon.\n    # Provider._record_to_dreamhost_record transfers to dreamhost-based record.\n    @staticmethod\n    def _id_to_dreamhost_record(identifier):\n        record = json.loads(\n            base64.urlsafe_b64decode(identifier.encode(\"utf-8\")).decode(\"utf-8\")\n        )\n        dreamhost_record = Provider._record_to_dreamhost_record(record)\n        return dreamhost_record\n\n    # The information in identifier follows the record in lexicon.\n    # 'id' is added in the record.\n    @staticmethod\n    def _id_to_record(identifier):\n        record = json.loads(\n            base64.urlsafe_b64decode(identifier.encode(\"utf-8\")).decode(\"utf-8\")\n        )\n        record[\"id\"] = identifier\n\n        return record\n\n    # Transferring lexicon-based record to Dreamhost-based record.\n    @staticmethod\n    def _record_to_dreamhost_record(record):\n        dreamhost_record = {\n            \"type\": record[\"type\"],\n            \"record\": record[\"name\"],\n            \"value\": record[\"content\"],\n        }\n        return dreamhost_record\n\n    def _authenticate(self):\n        self.domain_id = None\n        payload = self._get(\"dns-list_records\")\n        data = payload.get(\"data\", None)\n        if data is None:\n            raise AuthenticationError(\"Domain not found\")\n\n        for record in data:\n            if record.get(\"record\", \"\") == self.domain and record.get(\"type\", \"\") in [\"A\", \"AAAA\"]:\n                self.domain_id = self.domain\n                break\n        if self.domain_id is None:\n            raise AuthenticationError(\"Domain not found\")\n\n    def _create_record(self, rtype, name, content):\n        name = self._full_name(name)\n\n        try:\n            self._get(\n                \"dns-add_record\",\n                query_params={\"record\": name, \"type\": rtype, \"value\": content},\n            )\n        except AlreadyExistError:\n            pass\n\n        return True\n\n    # List all records. Return an empty list if no records found\n    # type, name and content are used to filter records.\n    # If possible filter during the query, otherwise filter after response is received.\n    def _list_records(self, rtype=None, name=None, content=None):\n\n        payload = self._get(\"dns-list_records\")\n\n        resource_list = payload.get(\"data\", None)\n        if not isinstance(resource_list, list):\n            raise Exception(f\"unable to get records: {payload}\")\n\n        resource_list = [\n            resource for resource in resource_list if resource[\"zone\"] == self.domain\n        ]\n        if rtype:\n            resource_list = [\n                resource for resource in resource_list if resource[\"type\"] == rtype\n            ]\n        if name:\n            name = self._full_name(name)\n            resource_list = [\n                resource for resource in resource_list if resource[\"record\"] == name\n            ]\n        if content:\n            resource_list = [\n                resource for resource in resource_list if resource[\"value\"] == content\n            ]\n\n        processed_records = []\n        for dreamhost_record in resource_list:\n            processed_records.append(\n                {\n                    \"id\": Provider._identifier(dreamhost_record),\n                    \"type\": dreamhost_record[\"type\"],\n                    \"name\": dreamhost_record[\"record\"],\n                    \"content\": dreamhost_record[\"value\"],\n                }\n            )\n\n        return processed_records\n\n    # Create or update a record.\n    def _update_record(self, identifier, rtype=None, name=None, content=None):\n        if identifier:\n            try:\n                self._delete_record(identifier)\n            except NonExistError:\n                pass\n\n        return self._create_record(rtype=rtype, name=name, content=content)\n\n    # Delete existing records.\n    # If record does not exist, do nothing.\n    def _delete_record(self, identifier=None, rtype=None, name=None, content=None):\n        to_deletes = []\n        if identifier:\n            record = Provider._id_to_record(identifier)\n            to_deletes.append(record)\n        else:\n            records = self._list_records(rtype=rtype, name=name, content=content)\n            to_deletes = records\n\n        # for-loop to delete deletes.\n        err = None\n        for each in to_deletes:\n            try:\n                dreamhost_record = Provider._record_to_dreamhost_record(each)\n                self._get(\"dns-remove_record\", query_params=dreamhost_record)\n\n            except Exception as exception:\n                err = exception\n\n            # Sleeping for 1-second to avoid trigerring ddos protecting in case of looped requests\n            time.sleep(1)\n\n        if err is not None:\n            raise err\n\n        return True\n\n    # Helpers\n    def _request(self, action=\"GET\", url=\"\", data=None, query_params=None):\n        if data is None:\n            data = {}\n\n        if query_params is None:\n            query_params = {}\n\n        default_headers = {\n            \"Accept\": \"application/json\",\n            \"Content-Type\": \"application/json\",\n        }\n\n        query_params[\"key\"] = self._get_provider_option(\"auth_token\")\n        query_params[\"format\"] = \"json\"\n        if \"cmd\" not in query_params:\n            query_params[\"cmd\"] = url\n\n        response = requests.request(\n            action,\n            self.api_endpoint,\n            params=query_params,\n            data=json.dumps(data),\n            headers=default_headers,\n        )\n\n        # if the request fails for any reason, throw an error.\n        response.raise_for_status()\n        result = response.json()\n        if result.get(\"result\", \"\") != \"success\":\n            err_msg = result.get(\"data\", \"\")\n            if err_msg in _DATA_NON_EXIST_ERROR_LIST:\n                raise NonExistError(f\"Dreamhost non-exist error: {result}\")\n            if err_msg in _DATA_ALREADY_EXIST_ERROR_LIST:\n                raise AlreadyExistError(f\"Dreamhost already-exist error: {result}\")\n            raise Exception(f\"Dreamhost api error: {result}\")\n        return result\n", "path": "lexicon/providers/dreamhost.py"}]}