def Backtracking_linesearch(f, x, lambda_newton, Delta_x,options):
    """
    The goal of this function is to perform a backtracking linesearch to adapt 
    the stepsize t of the Newton step, i.e. prepare a damped Newton step.
    For this, do the following:
        1. Imports and definitions
        2. Loop till conditions satisfied
        
    The stepsize t is reduced until the condition f(x+t Delta_x) < f(x) + 
    t alpha <grad_f, Delta_x> is satisfied.

    INPUTS
    The inputs consist in an objective function f used to check validity of the
    Hessian approximation as well as an evaluation point x and the Newton decrement
    lambda_newton. Furthermore, the descent direction Delta_x needs to be pro-
    vided together with some options on (alpha, beta, tolerances) that feature
    in backtracking line search algorithms.
    
    Name                 Interpretation                             Type
    f                   The objective function for which the       Function handle
                        Armijo optimality condition is to be
                        checked. Calculates the objective values
                        f(x) and f(x+t Delta_x). 
    x                   The position at which gradients and        Matrix [n_exp,n_exp]
                        search directions are evaluated.
    lambda_newton       The Newton decrement quantifying the       A positive real number
                        decrease of the objective function in   
                        the direction of Delta_x           
    Delta_x             Provides the descent direction, for        Matrix [n_exp,n_exp]
                        which a reasonable stepsize t is to be 
                        determined. The recommended update is 
                        then x = x + t Delta x    
    options             Tuple containing the values for alpha,    Tuple (alpha,beta,max_iter) 
                        beta and maximum iterations to arrive 
                        at a reasonable stepsize.
    
    OUTPUTS
    The outputs consist in the stepsize t, a real number guaranteeing that 
    Newton updates do not leave the psd cone.
    
    Name                 Interpretation                             Type
    t                   Stepsize for a robust damped Newton         Real number in [0,1]
                        update                      

    """

    
    
    """
        1. Imports and definitions -------------------------------------------
    """
    
    
    # i) Import packages
    
    
    
    # ii) Define auxiliary quantities   
        
    alpha=options[0]
    beta=options[1]
    max_iter=options[2]
    
    # iii) Initial function evaluations
    
    t=1
    f_val_x=f(x)
    f_val_x_mod=f(x+t*Delta_x)
    
    difference=f_val_x_mod-(f_val_x-alpha*t*(lambda_newton**2))
    
    
        
    """    
        2. Loop till conditions satisfied ------------------------------------
    """
    
    # i) Iterate
    
    k=1
    while difference>0 and k<max_iter:
        t=beta*t
        f_val_x_mod=f(x+t*Delta_x)
        difference=f_val_x_mod-(f_val_x-alpha*t*(lambda_newton**2))
        k=k+1
        
    if k==max_iter:
        t=0

    
    # ii) Assemble solution
    
    return t