Search the index for matches starting with target_prefix.

    Args:
       subject: The index to use. Should be a urn that points to the sha256
         namespace.
       target_prefix: The prefix to match against the index.
       limit: Either a tuple of (start, limit) or a maximum number of results to
         return.

    Yields:
      URNs of files which have the same data as this file - as read from the
      index.

def FileHashIndexQuery(self, subject, target_prefix, limit=100):
    """Search the index for matches starting with target_prefix.

    Args:
       subject: The index to use. Should be a urn that points to the sha256
         namespace.
       target_prefix: The prefix to match against the index.
       limit: Either a tuple of (start, limit) or a maximum number of results to
         return.

    Yields:
      URNs of files which have the same data as this file - as read from the
      index.
    """
    if isinstance(limit, (tuple, list)):
      start, length = limit  # pylint: disable=unpacking-non-sequence
    else:
      start = 0
      length = limit

    prefix = (DataStore.FILE_HASH_TEMPLATE % target_prefix).lower()
    results = self.ResolvePrefix(subject, prefix, limit=limit)

    for i, (_, hit, _) in enumerate(results):
      if i < start:
        continue
      if i >= start + length:
        break
      yield rdfvalue.RDFURN(hit)