def centering(var):
    """
    Check whether an object is in the values ['pixel', 'interpixel'].

    Parameters
    ----------
    var
        Variable to check

    Returns
    -------
    var
        Same value as input

    """
    _VALID_CENTERING = ['pixel', 'interpixel']
    _CENTERING_ERR = ('Invalid centering specification. Options: '
                      '{}'.format(_VALID_CENTERING))

    if not isinstance(var, str):
        raise TypeError("'centering' value must be a string'")
    if not (var in _VALID_CENTERING):
        raise ValueError(_CENTERING_ERR)
    return var