'Get the component alias from an S3FieldSelector (DRY Helper)
@param selector: the S3FieldSelector
@return: the alias as string or None for the master resource'

@staticmethod
def _alias(selector):

    alias = None
    if (selector and isinstance(selector, S3FieldSelector)):
        prefix = selector.name.split('$', 1)[0]
        if ('.' in prefix):
            alias = prefix.split('.', 1)[0]
        if (alias in ('~', '')):
            alias = None
    return alias
