def _is_direct(dep, tags):
    """
    Given tags containing info about direct dependencies in format @direct//, returns true if given
    label is a direct dependency and false otherwise

    Args:
      dep: Package name to check for
      tags: Tags passed to the rule
    """
    if (len(tags) == 0):
        return True
    for tag in tags:
        if tag.startswith("@direct//"):
            if dep == (tag[9:]):
                return True
    for tag in tags:
        if tag.startswith("@direct//"):
            return False
    return True