def check_flag(params, string, delete):
    """
    Check if a parameter (string) was beeen declared in the line of commands (params) and return the associated value.
    If delete is true the related string will be deleted
    If string is not present, return None
    Input:
       params = list of parameters from original command line
       string = string to be searched
       delete = Boolean variable to check if the selected string must be deleted after copied in value variable
    Output:
       value = parameter associated to the selected string
    """
    i = 0
    value = None
    size = len(string)
    for line in params:
        tmp = line.find(string)
        if tmp != -1:
            start = tmp + size
            sel_string = line[start:]
            if delete:
                params.pop(i)
            value = sel_string
        i += 1

    return value