code: def get_managed_zone(self, zone):
          
          if zone.endswith('.in-addr.arpa.'):
              return self.reverse_prefix + '-'.join(zone.split('.')[-5:-3])
          return self.forward_prefix + '-'.join(zone.split('.')[:-1])
docs: Get the GDNS managed zone name for a DNS zone.
  
          Google uses custom string names with specific `requirements
          <https://cloud.google.com/dns/api/v1/managedZones#resource>`_
          for storing records. The scheme implemented here chooses a
          managed zone name which removes the trailing dot and replaces
          other dots with dashes, and in the case of reverse records,
          uses only the two most significant octets, prepended with
          'reverse'. At least two octets are required for reverse DNS zones.
  
          Example:
             get_managed_zone('example.com.') = 'example-com'
             get_managed_zone('20.10.in-addr.arpa.) = 'reverse-20-10'
             get_managed_zone('30.20.10.in-addr.arpa.) = 'reverse-20-10'
             get_managed_zone('40.30.20.10.in-addr.arpa.) = 'reverse-20-10'
  
          Args:
              zone (str): DNS zone.
          Returns:
              str of managed zone name.