<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_service(self, service_type, plan_name, service_name, params, async=False, **kwargs):
 """ Create a service instance. """

        if self.space.has_service_with_name(service_name):
            logging.warning("Service already exists with that name.")
            return self.get_instance(service_name)

        if self.space.has_service_of_type(service_type):
            logging.warning("Service type already exists.")

        guid = self.get_service_plan_guid(service_type, plan_name)
        if not guid:
            raise ValueError("No service plan named: %s" % (plan_name))

        body = {
            'name': service_name,
            'space_guid': self.space.guid,
            'service_plan_guid': guid,
            'parameters': params
            }

        uri = '/v2/service_instances?accepts_incomplete=true'

        if async:
            uri += '&async=true'

        return self.api.post(uri, body)