def _segments_match(segments_to_match, arguments):
    """
    Tries to find matching segments in the arguments of the command
    that started the app. Will be used to determine whether we want
    to fetch translations or not.

    :param list(str) segments_to_match: The segments that should be
    matched. Expects to match all segments and will match subsequences
    as well (e.g. `./manage.py` will match `manage.py`)
    :param list(str) arguments: The arguments of the command that started
    the app (probably `sys.argv`)
    :rtype bool: Whether segments match or not
    """
    segments_to_match = set(segments_to_match)
    for arg in arguments:
        for segment in list(segments_to_match):
            if segment in arg:
                segments_to_match.remove(segment)
                if not segments_to_match:
                    return True
    return not segments_to_match
