Verify that a domain with the name self.domain exists. Else create it.
        :return:

def _verify_or_create_domain(self):
        """
        Verify that a domain with the name self.domain exists. Else create it.
        :return:
        """

        # Get all domains registered with the user
        r = requests.get(
            url=self.server + "/domains",
            auth=(self.username, self.password),
            headers=self.headers,
            json=self.data
        )
        if r.ok:
            names = []
            d = r.json()
            rdata = d["data"]
            if rdata:
                for d in rdata:
                    names.append(d["name"])
            if self.domain in names:
                return
        else:
            print "Error querying for domains for the configured user"
            print r.status_code, r.text
            return

        print "Domain %s is not created on rhcloud. Creating.."

        d = {"id": self.domain}
        d.update(self.data)

        r = requests.post(
            url= self.server + "/domains",
            auth= (self.username, self.password),
            headers = self.headers,
            json=d
        )
        if r.ok:
            print "Domain %s successfully created.." % self.domain

        else:
            print "Error creating domain for the configured user"
            print r.status_code, r.text
            return

        return r