code: def get_os_codename_install_source(src):
      '''Derive OpenStack release codename from a given installation source.'''
      ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
      rel = ''
      if src is None:
          return rel
      if src in ['distro', 'distro-proposed', 'proposed']:
          try:
              rel = UBUNTU_OPENSTACK_RELEASE[ubuntu_rel]
          except KeyError:
              e = 'Could not derive openstack release for '\
                  'this Ubuntu release: %s' % ubuntu_rel
              error_out(e)
          return rel
  
      if src.startswith('cloud:'):
          ca_rel = src.split(':')[1]
          ca_rel = ca_rel.split('-')[1].split('/')[0]
          return ca_rel
  
      # Best guess match based on deb string provided
      if (src.startswith('deb') or
              src.startswith('ppa') or
              src.startswith('snap')):
          for v in OPENSTACK_CODENAMES.values():
              if v in src:
                  return f get_os_codename_install_source(src):
      '''Derive OpenStack release codename from a given installation source.'''
      ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
      rel = ''
      if src is None:
          return rel
      if src in ['distro', 'distro-proposed', 'proposed']:
          try:
              rel = UBUNTU_OPENSTACK_RELEASE[ubuntu_rel]
          except KeyError:
              e = 'Could not derive openstack release for '\
                  'this Ubuntu release: %s' % ubuntu_rel
              error_out(e)
          return rel
  
      if src.startswith('cloud:'):
          ca_rel = src.split(':')[1]
          ca_rel = ca_rel.split('-')[1].split('/')[0]
          return ca_rel
  
      # Best guess match based on deb string provided
      if (src.startswith('deb') or
              src.startswith('ppa') or
              src.startswith('snap')):
          for v in OPENSTACK_CODENAMES.values():
              if v in src:
                  return v
docs: Derive OpenStack release codename from a given installation source.