<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def properties(self):
 """All species properties as a dict"""

        properties = {'id': self._id,
                      'boundary': self._boundary}
        if 'name' in self._root.attrib:
            properties['name'] = self._root.get('name')
        if 'compartment' in self._root.attrib:
            properties['compartment'] = self._root.get('compartment')

        charge = self.charge
        if charge is not None:
            properties['charge'] = charge

        formula = self.formula
        if formula is not None:
            properties['formula'] = formula

        return properties