<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def float_to_fp(signed, n_bits, n_frac):
 """Return a function to convert a floating point value to a fixed point value. For example, a function to convert a float to a signed fractional representation with 8 bits overall and 4 fractional bits (S3.4) can be constructed and used with:: '0x8' The fixed point conversion is saturating:: '0x0' '0xf0' '0xff' Parameters signed : bool Whether the values that are to be converted should be signed, or clipped at zero. '-0x8' '0x0' n_bits : int Total number of bits in the fixed-point representation (including sign bit and fractional bits). n_frac : int Number of fractional bits in the fixed-point representation. """

    # Calculate the maximum and minimum values
    if signed:
        max_v = (1 << (n_bits - 1)) - 1
        min_v = -max_v - 1
    else:
        min_v = 0
        max_v = (1 << n_bits) - 1

    # Compute the scale
    scale = 2.0**n_frac

    def bitsk(value):
        """Convert a floating point value to a fixed point value.

        Parameters
        ----------
        value : float
            The value to convert.
        """
        int_val = int(scale * value)
        return max((min(max_v, int_val), min_v))

    return bitsk