def roughness_Farshad(ID=None, D=None, coeffs=None):
    r'''Calculates of retrieves the roughness of a pipe based on the work of
    [1]_. This function will return an average value for pipes of a given
    material, or if diameter is provided, will calculate one specifically for
    the pipe inner diameter according to the following expression with 
    constants `A` and `B`:
    
    .. math::
        \epsilon = A\cdot D^{B+1}
    
    Please not that `A` has units of inches, and `B` requires `D` to be in 
    inches as well.
    
    The list of supported materials is as follows:

        * 'Plastic coated'
        * 'Carbon steel, honed bare'
        * 'Cr13, electropolished bare'
        * 'Cement lining'
        * 'Carbon steel, bare'
        * 'Fiberglass lining'
        * 'Cr13, bare'
    
    If `coeffs` and `D` are given, the custom coefficients for the equation as
    given by the user will be used and `ID` is not required.

    Parameters
    ----------
    ID : str, optional
        Name of pipe material from above list
    D : float, optional
        Actual inner diameter of pipe, [m]
    coeffs : tuple, optional
        (A, B) Coefficients to use directly, instead of looking them up;
        they are actually dimensional, in the forms (inch^-B, -) but only
        coefficients with those dimensions are available [-]

    Returns
    -------
    epsilon : float
        Roughness of pipe [m]
    
    Notes
    -----
    The diameter-dependent form provides lower roughness values for larger
    diameters.
    
    The measurements were based on DIN 4768/1 (1987), using both a 
    "Dektak ST Surface Profiler" and a "Hommel Tester T1000". Both instruments
    were found to be in agreement. A series of flow tests, in which pressure 
    drop directly measured, were performed as well, with nitrogen gas as an 
    operating fluid. The accuracy of the data from these tests is claimed to be
    within 1%.
    
    Using those results, the authors back-calculated what relative roughness 
    values would be necessary to produce the observed pressure drops. The 
    average difference between this back-calculated roughness and the measured
    roughness was 6.75%.
    
    For microchannels, this model will predict roughness much larger than the
    actual channel diameter.

    Examples
    --------
    >>> roughness_Farshad('Cr13, bare', 0.05)
    5.3141677781137006e-05

    References
    ----------
    .. [1] Farshad, Fred F., and Herman H. Rieke. "Surface Roughness Design 
       Values for Modern Pipes." SPE Drilling & Completion 21, no. 3 (September
       1, 2006): 212-215. doi:10.2118/89040-PA.
    '''
    # Case 1, coeffs given; only run if ID is not given.
    if ID is None and coeffs:
        A, B = coeffs
        return A*(D/inch)**(B+1)*inch
    # Case 2, lookup parameters
    try :
        dat = _Farshad_roughness[ID]
    except:
        raise KeyError('ID was not in _Farshad_roughness.')
    if D is None:
        return dat[0]
    else:
        A, B = dat[1], dat[2]
        return A*(D/inch)**(B+1)*inch
r'''Calculates of retrieves the roughness of a pipe based on the work of
    [1]_. This function will return an average value for pipes of a given
    material, or if diameter is provided, will calculate one specifically for
    the pipe inner diameter according to the following expression with 
    constants `A` and `B`:
    
    .. math::
        \epsilon = A\cdot D^{B+1}
    
    Please not that `A` has units of inches, and `B` requires `D` to be in 
    inches as well.
    
    The list of supported materials is as follows:

        * 'Plastic coated'
        * 'Carbon steel, honed bare'
        * 'Cr13, electropolished bare'
        * 'Cement lining'
        * 'Carbon steel, bare'
        * 'Fiberglass lining'
        * 'Cr13, bare'
    
    If `coeffs` and `D` are given, the custom coefficients for the equation as
    given by the user will be used and `ID` is not required.

    Parameters
    ----------
    ID : str, optional
        Name of pipe material from above list
    D : float, optional
        Actual inner diameter of pipe, [m]
    coeffs : tuple, optional
        (A, B) Coefficients to use directly, instead of looking them up;
        they are actually dimensional, in the forms (inch^-B, -) but only
        coefficients with those dimensions are available [-]

    Returns
    -------
    epsilon : float
        Roughness of pipe [m]
    
    Notes
    -----
    The diameter-dependent form provides lower roughness values for larger
    diameters.
    
    The measurements were based on DIN 4768/1 (1987), using both a 
    "Dektak ST Surface Profiler" and a "Hommel Tester T1000". Both instruments
    were found to be in agreement. A series of flow tests, in which pressure 
    drop directly measured, were performed as well, with nitrogen gas as an 
    operating fluid. The accuracy of the data from these tests is claimed to be
    within 1%.
    
    Using those results, the authors back-calculated what relative roughness 
    values would be necessary to produce the observed pressure drops. The 
    average difference between this back-calculated roughness and the measured
    roughness was 6.75%.
    
    For microchannels, this model will predict roughness much larger than the
    actual channel diameter.

    Examples
    --------
    >>> roughness_Farshad('Cr13, bare', 0.05)
    5.3141677781137006e-05

    References
    ----------
    .. [1] Farshad, Fred F., and Herman H. Rieke. "Surface Roughness Design 
       Values for Modern Pipes." SPE Drilling & Completion 21, no. 3 (September
       1, 2006): 212-215. doi:10.2118/89040-PA.