def create_app(self, name=None, stack_id_or_name='cedar', region_id_or_name=None):
        """Creates a new app."""

        payload = {}

        if name:
            payload['name'] = name

        if stack_id_or_name:
            payload['stack'] = stack_id_or_name

        if region_id_or_name:
            payload['region'] = region_id_or_name

        try:
            r = self._http_resource(
                method='POST',
                resource=('apps',),
                data=self._resource_serialize(payload)
            )
            r.raise_for_status()
            item = self._resource_deserialize(r.content.decode("utf-8"))
            app = App.new_from_dict(item, h=self)
        except HTTPError as e:
            if "Name is already taken" in str(e):
                print ("Warning - {0:s}".format(e))
                app = self.app(name)
                pass
            else:
                raise e
        return app
dataset/ETHPy150Open martyzz1/heroku3.py/heroku3/api.py/Heroku.create_app/original