def GetLegacySitelinksForCampaign(campaign_extension_service, campaign_id):
  """Get legacy sitelinks for a campaign.

  Args:
    campaign_extension_service: The CampaignAdExtensionServiceInterface
                                instance.
    campaign_id: ID of the campaign for which legacy sitelinks are retrieved.

  Returns:
    The CampaignAdExtension that contains the legacy sitelinks, or None if there
    are no legacy sitelinks in this campaign.
  """
  # Filter the results for specified campaign id.
  campaign_predicate = {
      'operator': 'EQUALS',
      'field': 'CampaignId',
      'values': [campaign_id]
  }

  # Filter the results for active campaign ad extensions. You may add
  # additional filtering conditions here as required.
  status_predicate = {
      'operator': 'EQUALS',
      'field': 'Status',
      'values': ['ACTIVE']
  }

  # Filter for sitelinks ad extension type.
  type_predicate = {
      'operator': 'EQUALS',
      'field': 'AdExtensionType',
      'values': ['SITELINKS_EXTENSION']
  }

  # Create the selector.
  selector = {
      'fields': ['AdExtensionId', 'DisplayText', 'DestinationUrl'],
      'predicates': [campaign_predicate, status_predicate, type_predicate]
  }

  page = campaign_extension_service.get(selector)[0]
  if 'entries' in page and page['entries']:
    return page['entries'][0]
  else:
    return None