code: def Registry(address='https://index.docker.io', **kwargs):
      
      registry = None
      try:
          try:
              registry = V1(address, **kwargs)
              registry.ping()
          except RegistryException:
              registry = V2(address, **kwargs)
              registry.ping()
      except OSError:
          logger.warning(
              'Was unable to verify certs for a registry @ {0}. '
              'Will not be able to interact with it for any operations until the certs can be validated.'.format(address)
          )
  
      return registry
docs: :return: