def create_model(self):
properties = {<EOL>'<STR_LIT:name>': self.name,<EOL>'<STR_LIT>': <NUM_LIT:1000><EOL>}<EOL>objective = self.get_active_objective()<EOL>if objective is not None:<EOL><INDENT>reactions = dict(objective.reactions)<EOL>if len(reactions) == <NUM_LIT:1>:<EOL><INDENT>reaction, value = next(iteritems(reactions))<EOL>if ((value < <NUM_LIT:0> and objective.type == '<STR_LIT>') or<EOL>(value > <NUM_LIT:0> and objective.type == '<STR_LIT>')):<EOL><INDENT>properties['<STR_LIT>'] = reaction<EOL><DEDENT><DEDENT><DEDENT>model = NativeModel(properties)<EOL>for compartment in self.compartments:<EOL><INDENT>model.compartments.add_entry(compartment)<EOL><DEDENT>for compound in self.species:<EOL><INDENT>model.compounds.add_entry(compound)<EOL><DEDENT>for reaction in self.reactions:<EOL><INDENT>model.reactions.add_entry(reaction)<EOL><DEDENT>for reaction in model.reactions:<EOL><INDENT>model.model[reaction.id] = None<EOL><DEDENT>for reaction in model.reactions:<EOL><INDENT>props = reaction.properties<EOL>if '<STR_LIT>' in props or '<STR_LIT>' in props:<EOL><INDENT>lower = props.get('<STR_LIT>')<EOL>upper = props.get('<STR_LIT>')<EOL>model.limits[reaction.id] = reaction.id, lower, upper<EOL><DEDENT><DEDENT>limits_lower = {}<EOL>limits_upper = {}<EOL>for bounds in self.flux_bounds:<EOL><INDENT>reaction = bounds.reaction<EOL>if reaction in model.limits:<EOL><INDENT>continue<EOL><DEDENT>if bounds.operation == SBMLFluxBoundEntry.LESS_EQUAL:<EOL><INDENT>if reaction not in limits_upper:<EOL><INDENT>limits_upper[reaction] = bounds.value<EOL><DEDENT>else:<EOL><INDENT>raise ParseError(<EOL>'<STR_LIT>'.format(reaction))<EOL><DEDENT><DEDENT>elif bounds.operation == SBMLFluxBoundEntry.GREATER_EQUAL:<EOL><INDENT>if reaction not in limits_lower:<EOL><INDENT>limits_lower[reaction] = bounds.value<EOL><DEDENT>else:<EOL><INDENT>raise ParseError(<EOL>'<STR_LIT>'.format(reaction))<EOL><DEDENT><DEDENT>elif bounds.operation == SBMLFluxBoundEntry.EQUAL:<EOL><INDENT>if (reaction not in limits_lower and<EOL>reaction not in limits_upper):<EOL><INDENT>limits_lower[reaction] = bounds.value<EOL>limits_upper[reaction] = bounds.value<EOL><DEDENT>else:<EOL><INDENT>raise ParseError(<EOL>'<STR_LIT>'.format(reaction))<EOL><DEDENT><DEDENT><DEDENT>for reaction in model.reactions:<EOL><INDENT>if reaction.id in limits_lower or reaction.id in limits_upper:<EOL><INDENT>lower = limits_lower.get(reaction.id, None)<EOL>upper = limits_upper.get(reaction.id, None)<EOL>model.limits[reaction.id] = reaction.id, lower, upper<EOL><DEDENT><DEDENT>return model<EOL>
Create model from reader.

        Returns:
            :class:`psamm.datasource.native.NativeModel`.