def sigmoid_across_unit_interval(p, k=1.2):
    """ Sigmoid transformation for a unit interval.

            Returns: a value [0,1] associated with a proportion [0,1]

            Parameters:

                p -- proportion across the unit interval [0,1]
                k -- shape of the simoid transformation

            Special return values based on k:

               if k==  0      then always return 0
               if 0 < k < 1   then always return 1

            For all continuous values for k >= 1.0

                1.0  step function with a sharp docs from 0 to 1 in the middle at p = 0.5
                1.1  very steep transition in the middle at p = 0.5
                1.2  transition looks much like a default logistic transition
                1.3  transition flattens, becoming more linear as k increases
                ...
                2.0  transition is almost linear by k = 2.0

            Source:

                Function inspired by suggestions made here:
                https://dinodini.wordpress.com/2010/04/05/normalized-tunable-sigmoid-functions/
    """
    assert p >= 0, 'Custom sigmoid function has a domain of [0,1]'
    assert p <= 1, 'Custom sigmoid function has a domain of [0,1]'
    assert k >= 0, 'Shaping parameter must always be > = 0'

    k = float(k)

    if k < 0.0000000001 : return 0   # special case
    if k < 1.0          : return 1   # special case

    p = (p * 2) - 1

    if not p: return 0.5  # undefined at inflection point
    if p < 0: return 0.5 + ((-k * p) / (-k + p + 1)) * .5
    else:     return 0.5 + ((-k * p) / (-k - p + 1)) * .5