parameters: (self, unit)
return_statement: return None
docstring: Get or create a unit for given space respecting possible automations
          :param unit: string unit
          :return: None if unit passed is invalid, Unit object otherwise
docstring_summary: Get or create a unit for given space respecting possible automations
          :param unit: string unit
          :return: None if unit passed is invalid, Unit object otherwise
docstring_tokens: Get or create a unit for given space respecting possible automations : param unit : string unit : return : None if unit passed is invalid Unit object otherwise
function: def get_unit(self, unit):
          """
          Get or create a unit for given space respecting possible automations
          :param unit: string unit
          :return: None if unit passed is invalid, Unit object otherwise
          """
          if not unit:
              return None
          if len(unit) > 0:
              u, created = Unit.objects.get_or_create(name=self.apply_unit_automation(unit), space=self.request.space)
              return u
          return None
function_tokens: def get_unit ( self , unit ) : if not unit : return None if len ( unit ) > 0 : u , created = Unit . objects . get_or_create ( name = self . apply_unit_automation ( unit ) , space = self . request . space ) return u return None