<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_subnet(self, snet):
 """Create subnet."""


        snet_id = snet.get('id')
        # This checks if the source of the subnet creation is FW,
        # If yes, this event is ignored.
        if self.fw_api.is_subnet_source_fw(snet.get('tenant_id'),
                                           snet.get('cidr')):
            LOG.info("Service subnet %s, returning", snet.get('cidr'))
            return
        if snet_id not in self.subnet:
            self.subnet[snet_id] = {}
            self.subnet[snet_id].update(snet)

        net = self.network.get(self.subnet[snet_id].get('network_id'))
        if not net:
            LOG.error('Network %(network_id)s does not exist.',
                      {'network_id': self.subnet[snet_id].get('network_id')})
            return

        # Check if the network is created by DCNM.
        query_net = self.get_network(net.get('id'))
        if query_net.result != constants.SUBNET_PENDING:
            LOG.info("Subnet exists, returning")
            return
        if query_net and query_net.source.lower() == 'dcnm':
            # The network is created by DCNM.
            # No need to process this event.
            LOG.info('create_subnet: network %(name)s '
                     'was created by DCNM. Ignoring processing the '
                     'event.', {'name': query_net.name})
            return

        tenant_name = self.get_project_name(snet['tenant_id'])
        subnet = utils.Dict2Obj(snet)
        dcnm_net = utils.Dict2Obj(net)
        if not tenant_name:
            LOG.error('Project %(tenant_id)s does not exist.',
                      {'tenant_id': subnet.tenant_id})
            self.update_network_db(dcnm_net.id, constants.CREATE_FAIL)
            return

        try:
            self.dcnm_client.create_network(tenant_name, dcnm_net, subnet,
                                            self.dcnm_dhcp)
            self.update_network_db(net.get('id'), constants.RESULT_SUCCESS)
        except dexc.DfaClientRequestFailed:
            LOG.exception('Failed to create network %(net)s.',
                          {'net': dcnm_net.name})
            # Update network database with failure result.
            self.update_network_db(dcnm_net.id, constants.CREATE_FAIL)
        self.network_sub_create_notif(snet.get('tenant_id'), tenant_name,
                                      snet.get('cidr'))