import re


def _get_frequency(table_name):
    """
    Finds the frequency of the data in the specified table name.

    :param str table_name: The name of the table
    :returns: The frequency of the data in the table
    :rtype: str
    :raises ValueError: If no frequency can be found in the table name
    """
    # remove Prim from the start of table names as this is not in capitals
    if table_name.startswith('Prim'):
        fixed_primavera = table_name[4:]
    else:
        fixed_primavera = table_name

    # The frequency is the first group of lower-case characters and digits in
    # the table name.
    components = re.search(r'[a-z\d]+', fixed_primavera)
    if components:
        return components.group(0)
    else:
        raise ValueError('Unable to calculate frequency from table name {}'.
                         format(table_name))