def getdigit(digit, data, labels):
    """ Returns the first image representing a digit of type num.
    Data and labels must be in the same order!

    Arguments:
        digit [integer] -- Type of digit to be returned
        data [np.array] -- List of all digits
        labels [np.array] -- List of all labels

    Return:
        [np.array] -- Returns a single image as np.array
    """
    # Search for first occurence of digit in labels
    i = 0;
    while True:
        # Did we find the right one?
        if labels[i] == digit:
            break;
        # Check next one
        i += 1;
    # Return corresponding image
    return data[i];