def normalise_period(val):
    """Return an integer from 1 to 12. 

    Parameters
    ----------
    val : str or int
        Variant for period. Should at least contain numeric characters.

    Returns
    -------
    int
        Number corresponding to financial period. 

    Examples
    --------
    >>> normalise_period('P6')
    6

    >>> normalise_period(202106)
    6
    """
    val = ''.join(c for c in str(val) if c.isdigit())
    return int(val[-2:])